Skip to content

[PW_SID:1148295] riscv: lib: Fix address overflow due to large count values in strnlen ZBB path - #2492

Closed
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1148295
Closed

[PW_SID:1148295] riscv: lib: Fix address overflow due to large count values in strnlen ZBB path#2492
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1148295

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 1148295 applied to workflow__riscv__fixes

Name: riscv: lib: Fix address overflow due to large count values in strnlen ZBB path
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1148295
Version: 1

… ZBB path

Hi all,

This patch fixes an issue in the RISC-V ZBB optimized strnlen implementation.

Problem description: When using the ZBB optimized strnlen implementation, passing very large count values (such as SIZE_MAX) can cause address overflow and return incorrect results.

This issue was observed in device-mapper tests:

sh-5.2# dmsetup create testname9 --table "0 8 zero"
sh-5.2# cat /sys/block/dm-*/dm/name
testname
sh-5.2# dmsetup remove testname9

The overflow in strnlen caused failures in string handling during device-mapper operations.

Patch summary:
- Explicitly introduce the strnlen_generic label.
- Simplify the generic implementation loop.
- Add fallback logic in strnlen_zbb to redirect to the generic path when a0 + a1 overflows.
This ensures correct behavior for large count values and SIZE_MAX cases.

Fixes: 5ba15d4 ("riscv: lib: add strnlen() implementation")
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 142.17 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1190.93 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1415.40 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.77 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.71 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.67 seconds
Result: WARNING
Output:

WARNING: From:/Signed-off-by: email name mismatch: 'From: "gao.rui@zte.com.cn" <gao.rui@zte.com.cn>' != 'Signed-off-by: Gao Rui <gao.rui@zte.com.cn>'

total: 0 errors, 1 warnings, 0 checks, 43 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit c2abde56b29f ("riscv: lib: Fix address overflow due to large count values in strnlen ZBB path") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 1 warnings, 0 checks, 43 lines checked
WARNING: From:/Signed-off-by: email name mismatch: 'From: "gao.rui@zte.com.cn" <gao.rui@zte.com.cn>' != 'Signed-off-by: Gao Rui <gao.rui@zte.com.cn>'


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 87.47 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
kdoc
Desc: Detects for kdoc errors
Duration: 0.85 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "riscv: lib: Fix address overflow due to large count values in strnlen ZBB path"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
linux-riscv-bot deleted the pw1148295 branch August 21, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants