[PATCH v4 0/2] fs: semihosting: Test correct variable and fix API
Andrew Goodbody
andrew.goodbody at linaro.org
Tue Oct 14 18:03:49 CEST 2025
Smatch reported an issue that the wrong variable was being tested after
a call to smh_flen(). Investigating this showed that the API was being
used incorrectly and attempted to return negative errors through an
unsigned return value. This in turn also limited the returns to being
less than 2GB. This series allows the use of file sizes up to 4GB - 2
and also corrects the error detection.
Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
Changes in v4:
- Split out changes to smh_read into separate patch
- Link to v3: https://lore.kernel.org/r/20251003-fs_semihosting-v3-1-5f6de9b7f225@linaro.org
Changes in v3:
- V2 missed fixing up one use of smh_flen, fix it
- Link to v2: https://lore.kernel.org/r/20251002-fs_semihosting-v2-1-c1783e4188d8@linaro.org
Changes in v2:
- Fixup smh_flen and smh_read to allow for > 2^31 byte files
- Link to v1: https://lore.kernel.org/r/20251002-fs_semihosting-v1-1-1124e6becc51@linaro.org
---
Andrew Goodbody (2):
fs: semihosting: Fixup smh_read against overflow
fs: semihosting: Fixup smh_flen against overflow
common/spl/spl_semihosting.c | 13 +++++++------
drivers/serial/serial_semihosting.c | 6 ++++--
fs/semihostingfs.c | 23 +++++++++++++----------
include/semihosting.h | 13 +++++++------
lib/semihosting.c | 28 ++++++++++++++++++++++------
5 files changed, 53 insertions(+), 30 deletions(-)
---
base-commit: ecdc3872a767fb045be3296d4317ae978a14b022
change-id: 20251002-fs_semihosting-85d697fbfcad
Best regards,
--
Andrew Goodbody <andrew.goodbody at linaro.org>
More information about the U-Boot
mailing list