Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/mmc-utils: fix build failure due to a warning and -Werror enabled
@ 2022-09-18 12:53 Giulio Benetti
  2022-09-18 15:37 ` Yann E. MORIN
  0 siblings, 1 reply; 5+ messages in thread
From: Giulio Benetti @ 2022-09-18 12:53 UTC (permalink / raw)
  To: buildroot; +Cc: Giulio Benetti

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/

Fixes:
http://autobuild.buildroot.net/results/18c4fce5416e5d1ccd95900ccef87d4c045a361e/

Signed-off-by: Giulio Benetti <giulio.benetti@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@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@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@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/mmc-utils: fix build failure due to a warning and -Werror enabled
  2022-09-18 12:53 [Buildroot] [PATCH] package/mmc-utils: fix build failure due to a warning and -Werror enabled Giulio Benetti
@ 2022-09-18 15:37 ` Yann E. MORIN
  2022-09-18 16:22   ` Giulio Benetti
  2022-09-18 16:31   ` [Buildroot] [PATCH v2] " Giulio Benetti
  0 siblings, 2 replies; 5+ messages in thread
From: Yann E. MORIN @ 2022-09-18 15:37 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: buildroot

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@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@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@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@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.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/mmc-utils: fix build failure due to a warning and -Werror enabled
  2022-09-18 15:37 ` Yann E. MORIN
@ 2022-09-18 16:22   ` Giulio Benetti
  2022-09-18 16:23     ` Giulio Benetti
  2022-09-18 16:31   ` [Buildroot] [PATCH v2] " Giulio Benetti
  1 sibling, 1 reply; 5+ messages in thread
From: Giulio Benetti @ 2022-09-18 16:22 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

Hi Arnd,

On 18/09/22 17:37, Yann E. MORIN wrote:
> 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.

Yes, he's totally right and I've just re-spinned V3 patch:
https://lore.kernel.org/linux-mmc/20220918124210.1127345-1-giulio.benetti@benettiengineering.com/T/#mce3840c0bf84e1743552aa9428ef9097b613c610

Now I prepare send the V2 Buildroot patch.

Best regards
-- 
Giulio Benetti
Benetti Engineering sas

> Regards,
> Yann E. MORIN.
> 
>> http://autobuild.buildroot.net/results/18c4fce5416e5d1ccd95900ccef87d4c045a361e/
>>
>> Signed-off-by: Giulio Benetti <giulio.benetti@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@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@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@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH] package/mmc-utils: fix build failure due to a warning and -Werror enabled
  2022-09-18 16:22   ` Giulio Benetti
@ 2022-09-18 16:23     ` Giulio Benetti
  0 siblings, 0 replies; 5+ messages in thread
From: Giulio Benetti @ 2022-09-18 16:23 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

On 18/09/22 18:22, Giulio Benetti wrote:
> Hi Arnd,

s/Arnd/Yann sorry!

-- 
Giulio Benetti
Benetti Engineering sas

> On 18/09/22 17:37, Yann E. MORIN wrote:
>> 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.
> 
> Yes, he's totally right and I've just re-spinned V3 patch:
> https://lore.kernel.org/linux-mmc/20220918124210.1127345-1-giulio.benetti@benettiengineering.com/T/#mce3840c0bf84e1743552aa9428ef9097b613c610
> 
> Now I prepare send the V2 Buildroot patch.
> 
> Best regards

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] package/mmc-utils: fix build failure due to a warning and -Werror enabled
  2022-09-18 15:37 ` Yann E. MORIN
  2022-09-18 16:22   ` Giulio Benetti
@ 2022-09-18 16:31   ` Giulio Benetti
  1 sibling, 0 replies; 5+ messages in thread
From: Giulio Benetti @ 2022-09-18 16:31 UTC (permalink / raw)
  To: buildroot; +Cc: Giulio Benetti, Yann E . MORIN

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/20220918161751.1132590-1-giulio.benetti@benettiengineering.com/

Fixes:
http://autobuild.buildroot.net/results/18c4fce5416e5d1ccd95900ccef87d4c045a361e/

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
V1->V2:
* change local patch approach after feedback in linux-mmc mailing list
---
 ...ils-fix-warning-on-uninitialized-cnt.patch | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 package/mmc-utils/0002-mmc-utils-fix-warning-on-uninitialized-cnt.patch

diff --git a/package/mmc-utils/0002-mmc-utils-fix-warning-on-uninitialized-cnt.patch b/package/mmc-utils/0002-mmc-utils-fix-warning-on-uninitialized-cnt.patch
new file mode 100644
index 0000000000..04ba6ea399
--- /dev/null
+++ b/package/mmc-utils/0002-mmc-utils-fix-warning-on-uninitialized-cnt.patch
@@ -0,0 +1,47 @@
+From 639a80658dfe4302617a3fd22cbae4714efd40b6 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Sun, 18 Sep 2022 14:10:29 +0200
+Subject: [PATCH] mmc-utils: fix warning on uninitialized 'cnt'
+
+When building following warning shows up:
+```
+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
+```
+This is due to function rpmb_read_counter() that doesn't set its
+argument 'unsigned int *cnt' in all return points. So let's set
+*cnt to 0 in the return point that misses to initialize it.
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+[Upstream status: https://patchwork.kernel.org/project/linux-mmc/patch/20220918161751.1132590-1-giulio.benetti@benettiengineering.com/]
+---
+ mmc_cmds.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mmc_cmds.c b/mmc_cmds.c
+index 12b7802..4d203ef 100644
+--- a/mmc_cmds.c
++++ b/mmc_cmds.c
+@@ -2238,8 +2238,10 @@ int rpmb_read_counter(int dev_fd, unsigned int *cnt)
+ 	}
+ 
+ 	/* Check RPMB response */
+-	if (frame_out.result != 0)
++	if (frame_out.result != 0) {
++		*cnt = 0;
+ 		return be16toh(frame_out.result);
++	}
+ 
+ 	*cnt = be32toh(frame_out.write_counter);
+ 
+-- 
+2.34.1
+
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-18 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-18 12:53 [Buildroot] [PATCH] package/mmc-utils: fix build failure due to a warning and -Werror enabled Giulio Benetti
2022-09-18 15:37 ` Yann E. MORIN
2022-09-18 16:22   ` Giulio Benetti
2022-09-18 16:23     ` Giulio Benetti
2022-09-18 16:31   ` [Buildroot] [PATCH v2] " Giulio Benetti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox