mm: shmem: Fix variable type to int to evaluate negative conditions
Subsystems (2)
PATCH 1/1 mm: shmem: Fix variable type to int to evaluate negative conditions
version variable captures return value from utf8_parse_version function which can be negative, but unsigned won't
let it capture, thus missing the further checks on negative values.
---
Coverity Message:
CID 1601569: (#1 of 1): Unsigned compared against 0 (NO_EFFECT)unsigned_compare: This less-than-zero comparison of an unsigned value is never true. version < 0U
Coverity Link:
https://scan7.scan.coverity.com/#/project-view/10043/11354?selectedIssue=1601569
--- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
@@ -4367,7 +4367,7 @@ static int shmem_parse_opt_casefold(struct fs_context *fc, struct fs_parameter * bool latest_version) {struct shmem_options *ctx = fc->fs_private; -unsigned int version =UTF8_LATEST ; +int version =UTF8_LATEST ;struct unicode_map *encoding;char *version_str = param->string +5 ;
---
base-commit: 6d59cab07b8d74d0f0422b750038123334f6ecc2
change-id: 20241111-unsignedcompare1601569-05b5932145ef
Best regards,
Signature · 1 line
Karan Sanghavi <[email protected]>
Em 11/11/2024 14:10, Karan Sanghavi escreveu:
Quoted 6 lines
version variable captures return value from
utf8_parse_versionfunction which can be negative, but unsigned won't
let it capture, thus missing the further checks on negative values.Fixes 58e55efd6c72 ("tmpfs: Add casefold lookup support")Signed-off-by Karan Sanghavi <[email protected]>
Quoted 11 lines · Karan Sanghavi
version variable captures return value from
utf8_parse_versionfunction which can be negative, but unsigned won't
let it capture, thus missing the further checks on negative values.Fixes 58e55efd6c72 ("tmpfs: Add casefold lookup support")Signed-off-by Karan Sanghavi <[email protected]>---
Coverity Message:
CID 1601569: (#1 of 1): Unsigned compared against 0 (NO_EFFECT)unsigned_compare: This less-than-zero comparison of an unsigned value is never true. version < 0U
Quoted 26 lines
Coverity Link:
https://scan7.scan.coverity.com/#/project-view/10043/11354?selectedIssue=1601569--- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/shmem.c +1
-2@@ -4367,7 +4367,7 @@ static int shmem_parse_opt_casefold(struct fs_context *fc, struct fs_parameter * bool latest_version) {struct shmem_options *ctx = fc->fs_private; -unsigned int version =UTF8_LATEST ; +int version =UTF8_LATEST ;struct unicode_map *encoding;char *version_str = param->string +5 ; ---base-commit:
6d59cab07b8d74d0f0422b750038123334f6ecc2
change-id: 20241111-unsignedcompare1601569-05b5932145efBest regards,
Signature · 1 line
Gabriel Krisman Bertazi
Quoted 38 lines · Gabriel Krisman Bertazi
Quoted 11 lines · Karan Sanghavi
version variable captures return value from
utf8_parse_versionfunction which can be negative, but unsigned won't
let it capture, thus missing the further checks on negative values.Fixes 58e55efd6c72 ("tmpfs: Add casefold lookup support")Signed-off-by Karan Sanghavi <[email protected]>---
Coverity Message:
CID 1601569: (#1 of 1): Unsigned compared against 0 (NO_EFFECT)unsigned_compare: This less-than-zero comparison of an unsigned value is never true. version < 0UReviewed-by Gabriel Krisman Bertazi <[email protected]>Quoted 21 lines
Coverity Link:
https://scan7.scan.coverity.com/#/project-view/10043/11354?selectedIssue=1601569--- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/shmem.c +1
-1@@ -4367,7 +4367,7 @@ static int shmem_parse_opt_casefold(struct fs_context *fc, struct fs_parameter * bool latest_version) {struct shmem_options *ctx = fc->fs_private; -unsigned int version =UTF8_LATEST ; +int version =UTF8_LATEST ;struct unicode_map *encoding;char *version_str = param->string +5 ;
Quoted 8 lines
Quoted 5 lines
---
base-commit:6d59cab07b8d74d0f0422b750038123334f6ecc2
change-id: 20241111-unsignedcompare1601569-05b5932145efBest regards,
Signature · 1 line
Gabriel Krisman Bertazi
Dear Gabriel and André,
I hope this email finds you well.
I'm following up on the patch I had submitted linked below.
https://lore.kernel.org/all/[email protected]/
I noticed it hasn't been applied yet, and I wanted to see if there was anything else needed from my end.
Please let me know if any further information or modifications are required. I appreciate your time and feedback.
Thank you!
Sincerely,
Karan.
…
Quoted 3 lines
---
Coverity Message:
CID 1601569: (#1 of 1): Unsigned compared against 0 (NO_EFFECT)
…
Can such information become a part of the change description?
Would a summary phrase like “Use signed data type for version handling in shmem_parse_opt_casefold()” be more appropriate?
Regards,
Markus