diff mbox series

test: cmd: mbr: Fix Smatch static checker warning

Message ID Zb2rU_JCEkRionLj@alg-gentoo
State Accepted
Commit 8904e933a3aa01a2559d38e081703ed6fd92807d
Delegated to: Tom Rini
Headers show
Series test: cmd: mbr: Fix Smatch static checker warning | expand

Commit Message

Alexander Gendin Feb. 3, 2024, 2:56 a.m. UTC
This patch fixes Smatch static checker warning:
        test/cmd/mbr.c:243 mbr_test_run()
        warn: sizeof(NUMBER)?

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alexander Gendin <agendin@matrox.com>
---
 test/cmd/mbr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Heinrich Schuchardt Feb. 3, 2024, 6:55 a.m. UTC | #1
On 2/3/24 03:56, Alexander Gendin wrote:
> This patch fixes Smatch static checker warning:
>          test/cmd/mbr.c:243 mbr_test_run()
>          warn: sizeof(NUMBER)?
>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Alexander Gendin <agendin@matrox.com>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>   test/cmd/mbr.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c
> index 46b78e706c..235b363290 100644
> --- a/test/cmd/mbr.c
> +++ b/test/cmd/mbr.c
> @@ -240,7 +240,11 @@ static int mbr_test_run(struct unit_test_state *uts)
>   	ut_assert(ofnode_valid(node));
>   	ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false));
>
> -	mbr_parts_max = sizeof('\0') + 2 +
> +	/*
> +	 * 1 byte for null character
> +	 * 2 reserved bytes
> +	 */
> +	mbr_parts_max = 1 + 2 +
>   		strlen(mbr_parts_header) +
>   		strlen(mbr_parts_p1) +
>   		strlen(mbr_parts_p2) +
Tom Rini March 4, 2024, 3:27 p.m. UTC | #2
On Sat, Feb 03, 2024 at 02:56:19AM +0000, Alexander Gendin wrote:

> This patch fixes Smatch static checker warning:
>         test/cmd/mbr.c:243 mbr_test_run()
>         warn: sizeof(NUMBER)?
> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Alexander Gendin <agendin@matrox.com>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c
index 46b78e706c..235b363290 100644
--- a/test/cmd/mbr.c
+++ b/test/cmd/mbr.c
@@ -240,7 +240,11 @@  static int mbr_test_run(struct unit_test_state *uts)
 	ut_assert(ofnode_valid(node));
 	ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false));
 
-	mbr_parts_max = sizeof('\0') + 2 +
+	/*
+	 * 1 byte for null character
+	 * 2 reserved bytes
+	 */
+	mbr_parts_max = 1 + 2 +
 		strlen(mbr_parts_header) +
 		strlen(mbr_parts_p1) +
 		strlen(mbr_parts_p2) +