[Buildroot] [PATCH] package/mmc-utils: fix build failure due to a warning and -Werror enabled

Yann E. MORIN yann.morin.1998 at free.fr
Sun Sep 18 15:37:10 UTC 2022


Giulio, All,

On 2022-09-18 14:53 +0200, Giulio Benetti spake thusly:
> Add patch to fix warning that is treated like error:
> ```
> In function '__bswap_32',
>     inlined from 'do_rpmb_write_block' at mmc_cmds.c:2293:27:
> /home/autobuild/autobuild/instance-15/output-1/host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/byteswap.h:52:10: error: 'cnt' may be used uninitialized [-Werror=maybe-uninitialized]
>    52 |   return __builtin_bswap32 (__bsx);
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~
> mmc_cmds.c: In function 'do_rpmb_write_block':
> mmc_cmds.c:2270:22: note: 'cnt' was declared here
>  2270 |         unsigned int cnt;
>       |                      ^~~
> cc1: all warnings being treated as errors
> ```
> Patch is pending upstream:
> https://patchwork.kernel.org/project/linux-mmc/patch/20220918124210.1127345-1-giulio.benetti@benettiengineering.com/

Arnd requested a different fix, arguing the one you proposed is hiding a
compiler warning without fixing the root cause.

Regards,
Yann E. MORIN.

> http://autobuild.buildroot.net/results/18c4fce5416e5d1ccd95900ccef87d4c045a361e/
> 
> Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
> ---
>  ...ds.c-fix-warning-on-uninitialized-cn.patch | 27 +++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100644 package/mmc-utils/0002-mmc-utils-mmc_cmds.c-fix-warning-on-uninitialized-cn.patch
> 
> diff --git a/package/mmc-utils/0002-mmc-utils-mmc_cmds.c-fix-warning-on-uninitialized-cn.patch b/package/mmc-utils/0002-mmc-utils-mmc_cmds.c-fix-warning-on-uninitialized-cn.patch
> new file mode 100644
> index 0000000000..e2f74879a6
> --- /dev/null
> +++ b/package/mmc-utils/0002-mmc-utils-mmc_cmds.c-fix-warning-on-uninitialized-cn.patch
> @@ -0,0 +1,27 @@
> +From bf783bbc2da0348591dd317ccd53bbfc5a57f2f8 Mon Sep 17 00:00:00 2001
> +From: Giulio Benetti <giulio.benetti at benettiengineering.com>
> +Date: Sun, 18 Sep 2022 14:10:29 +0200
> +Subject: [PATCH] mmc-utils: mmc_cmds.c: fix warning on uninitialized 'cnt'
> +
> +Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
> +[Upstream status: https://patchwork.kernel.org/project/linux-mmc/patch/20220918124210.1127345-1-giulio.benetti@benettiengineering.com/]
> +---
> + mmc_cmds.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/mmc_cmds.c b/mmc_cmds.c
> +index 12b7802..777d649 100644
> +--- a/mmc_cmds.c
> ++++ b/mmc_cmds.c
> +@@ -2436,7 +2436,7 @@ int do_rpmb_write_block(int nargs, char **argv)
> + 	int ret, dev_fd, key_fd, data_fd;
> + 	unsigned char key[32];
> + 	uint16_t addr;
> +-	unsigned int cnt;
> ++	unsigned int cnt = 0;
> + 	struct rpmb_frame frame_in = {
> + 		.req_resp    = htobe16(MMC_RPMB_WRITE),
> + 		.block_count = htobe16(1)
> +-- 
> +2.34.1
> +
> -- 
> 2.34.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list