diff mbox series

[RESEND,v3,1/1] support: kconfig: Fix compiler warnings

Message ID 20260512105602.83368-2-kanak.shilledar@axis.com
State Superseded
Headers show
Series support: kconfig: Fix compiler warnings | expand

Commit Message

Kanak Shilledar May 12, 2026, 10:56 a.m. UTC
Add a new patch to fix the compiler warning given on Ubuntu 24.04.4 in
`util.c` warning of `-Wformat-overflow=`.

```
./util.c: In function ‘file_write_dep’:
./util.c:86:26: warning: ‘%s’ directive writing 10 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
   86 |         sprintf(buf2, "%s%s", dir, name);
      |                          ^~
./util.c:86:9: note: ‘sprintf’ output 11 or more bytes (assuming 4107) into a destination of size 4097
   86 |         sprintf(buf2, "%s%s", dir, name);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Update `buf2` to `PATH_MAX+20` similar to `buf`, thus giving enough
headroom for the filename suffix.

--
Changes in v3:
* Updated the commit message
* Generated the patch using `git format-patch`, and added to the
  `series`.

--
Changes in v2:
* Changed from direct file fix to patch based fix.

Signed-off-by: Kanak Shilledar <kanak.shilledar@axis.com>
---
 ...upport-kconfig-Fix-compiler-warnings.patch | 45 +++++++++++++++++++
 support/kconfig/patches/series                |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 support/kconfig/patches/24-support-kconfig-Fix-compiler-warnings.patch

Comments

Edgar Bonet May 12, 2026, 1:36 p.m. UTC | #1
Hello Buildroot people!

On 2026-05-12, Kanak Shilledar wrote:
> Add a new patch to fix the compiler warning given on Ubuntu 24.04.4 in
> `util.c` warning of `-Wformat-overflow=`. [...]

This seems to me like a duplicate of a patch[1] I sent in July 2025, as
part of a series[2] that also updated support/kconfig/patches/.

Also, both your patch and my series are likely in conflict with a more
comprehensive rework of kconfig[3] proposed by Titouan Christophe on
2026-02-04.

Regards,

Edgar Bonet.

[1] https://lists.buildroot.org/pipermail/buildroot/2025-July/782825.html
[2] https://lists.buildroot.org/pipermail/buildroot/2025-July/782822.html
[3] https://lists.buildroot.org/pipermail/buildroot/2026-February/796328.html
Petr Vorel May 12, 2026, 9:16 p.m. UTC | #2
Hi all,

[ Cc Edgar and Arnout involved in 324612d68e and Titouan working on kconfig
update ]

@Kanak I'm sorry, reading the description of the failure:
324612d68e ("support/kconfig: fix compiler warnings")

    Normally, we want changes to kconfig to be reflected by patches in
    support/kconfig/patches. This makes it easier to resync with upstream
    kconfig. However, in this case, everything that is changed here is
    already changed completely (and differently) upstream, so there is no
    added value in keeping the patch.

That means I was wrong in v1 where I asked for creating a patch.
OTOH it's a bit confusing, it should be at least documented in
support/kconfig/README.buildroot.

> Hello Buildroot people!

> On 2026-05-12, Kanak Shilledar wrote:
> > Add a new patch to fix the compiler warning given on Ubuntu 24.04.4 in
> > `util.c` warning of `-Wformat-overflow=`. [...]

> This seems to me like a duplicate of a patch[1] I sent in July 2025, as
> part of a series[2] that also updated support/kconfig/patches/.

Thanks, for pointing this out. Indeed it is. I'm sorry that I haven't finished
the review. Unfortunately nobody else haven't reviewed it [4] [5] (state new in
patchwork for one year old patch is not good).

> Also, both your patch and my series are likely in conflict with a more
> comprehensive rework of kconfig[3] proposed by Titouan Christophe on
> 2026-02-04.
[6] [7]

Thanks for the reminder. I'd actually prefer to have this update. There is some
requirement to change it but that should be trivial to fix in new version.
@Titouan do you plan to send a new version?

Kind regards,
Petr

> Regards,

> Edgar Bonet.

> [1] https://lists.buildroot.org/pipermail/buildroot/2025-July/782825.html
> [2] https://lists.buildroot.org/pipermail/buildroot/2025-July/782822.html
> [3] https://lists.buildroot.org/pipermail/buildroot/2026-February/796328.html
[4] https://patchwork.ozlabs.org/project/buildroot/list/?series=465475&state=*
[5] https://lore.kernel.org/buildroot/c8467198-efc1-45f9-86ef-0726d06df295@grenoble.cnrs.fr/#r
[6] https://patchwork.ozlabs.org/project/buildroot/list/?series=490997&state=*
[7] https://lore.kernel.org/buildroot/20260204154340.766528-1-titouan.christophe@mind.be/#r
[8] https://lore.kernel.org/buildroot/20260205082847.4b855528@pc-1/
Kanak Shilledar May 18, 2026, 2:15 p.m. UTC | #3
Thanks for the clarification!
On Tue, 2026-05-12 at 23:16 +0200, Petr Vorel wrote:
> Hi all,
> 
> [ Cc Edgar and Arnout involved in 324612d68e and Titouan working on
> kconfig
> update ]
> 
> @Kanak I'm sorry, reading the description of the failure:
> 324612d68e ("support/kconfig: fix compiler warnings")
> 
>     Normally, we want changes to kconfig to be reflected by patches
> in
>     support/kconfig/patches. This makes it easier to resync with
> upstream
>     kconfig. However, in this case, everything that is changed here
> is
>     already changed completely (and differently) upstream, so there
> is no
>     added value in keeping the patch.
> 
> That means I was wrong in v1 where I asked for creating a patch.
> OTOH it's a bit confusing, it should be at least documented in
> support/kconfig/README.buildroot.
> 
> > Hello Buildroot people!
> 
> > On 2026-05-12, Kanak Shilledar wrote:
> > > Add a new patch to fix the compiler warning given on Ubuntu
> > > 24.04.4 in
> > > `util.c` warning of `-Wformat-overflow=`. [...]
> 
> > This seems to me like a duplicate of a patch[1] I sent in July
> > 2025, as
> > part of a series[2] that also updated support/kconfig/patches/.
> 
> Thanks, for pointing this out. Indeed it is. I'm sorry that I haven't
> finished
> the review. Unfortunately nobody else haven't reviewed it [4] [5]
> (state new in
> patchwork for one year old patch is not good).
> 
> > Also, both your patch and my series are likely in conflict with a
> > more
> > comprehensive rework of kconfig[3] proposed by Titouan Christophe
> > on
> > 2026-02-04.
> [6] [7]
> 
> Thanks for the reminder. I'd actually prefer to have this update.
> There is some
> requirement to change it but that should be trivial to fix in new
> version.
> @Titouan do you plan to send a new version?
> 
> Kind regards,
> Petr
> 
> > Regards,
> 
> > Edgar Bonet.
> 
> > [1]
> > https://lists.buildroot.org/pipermail/buildroot/2025-July/782825.html
> > [2]
> > https://lists.buildroot.org/pipermail/buildroot/2025-July/782822.html
> > [3]
> > https://lists.buildroot.org/pipermail/buildroot/2026-February/796328.html
> [4]
> https://patchwork.ozlabs.org/project/buildroot/list/?series=465475&state=*
> [5]
> https://lore.kernel.org/buildroot/c8467198-efc1-45f9-86ef-0726d06df295@grenoble.cnrs.fr/#r
> [6]
> https://patchwork.ozlabs.org/project/buildroot/list/?series=490997&state=*
> [7]
> https://lore.kernel.org/buildroot/20260204154340.766528-1-titouan.christophe@mind.be/#r
> [8] https://lore.kernel.org/buildroot/20260205082847.4b855528@pc-1/


Best Regards,
Kanak Shilledar
Peter Korsgaard May 29, 2026, 10:43 a.m. UTC | #4
>>>>> "Kanak" == Kanak Shilledar <kanak.shilledar@axis.com> writes:

 > Add a new patch to fix the compiler warning given on Ubuntu 24.04.4 in
 > `util.c` warning of `-Wformat-overflow=`.

 > ```
 > ./util.c: In function ‘file_write_dep’:
 > ./util.c:86:26: warning: ‘%s’ directive writing 10 or more bytes into
 > a region of size between 1 and 4097 [-Wformat-overflow=]
 >    86 |         sprintf(buf2, "%s%s", dir, name);
 >       |                          ^~
 > ./util.c:86:9: note: ‘sprintf’ output 11 or more bytes (assuming 4107)
 > into a destination of size 4097
 >    86 |         sprintf(buf2, "%s%s", dir, name);
 >       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 > ```

 > Update `buf2` to `PATH_MAX+20` similar to `buf`, thus giving enough
 > headroom for the filename suffix.

 > --
 > Changes in v3:
 > * Updated the commit message
 > * Generated the patch using `git format-patch`, and added to the
 >   `series`.

 > --
 > Changes in v2:
 > * Changed from direct file fix to patch based fix.

Given that the issue was introduced in commit 324612d68e09d0db4 which
did NOT add a patch I have instead applied:

https://patchwork.ozlabs.org/project/buildroot/patch/20260507123534.318763-1-thomas@devoogdt.com/

And marked this patch as superseeded.
diff mbox series

Patch

diff --git a/support/kconfig/patches/24-support-kconfig-Fix-compiler-warnings.patch b/support/kconfig/patches/24-support-kconfig-Fix-compiler-warnings.patch
new file mode 100644
index 0000000000..4c76274123
--- /dev/null
+++ b/support/kconfig/patches/24-support-kconfig-Fix-compiler-warnings.patch
@@ -0,0 +1,45 @@ 
+From 392624743e7166a056474cd83b18743409d2556c Mon Sep 17 00:00:00 2001
+From: Kanak Shilledar <kanak.shilledar@axis.com>
+Date: Fri, 24 Apr 2026 13:32:36 +0200
+Subject: [PATCH] support: kconfig: Fix compiler warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+On Ubuntu 24.04.4, the compiler gives the warning of
+`-Wformat-overflow=`.
+
+```
+./util.c: In function ‘file_write_dep’:
+./util.c:86:26: warning: ‘%s’ directive writing 10 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
+   86 |         sprintf(buf2, "%s%s", dir, name);
+      |                          ^~
+./util.c:86:9: note: ‘sprintf’ output 11 or more bytes (assuming 4107) into a destination of size 4097
+   86 |         sprintf(buf2, "%s%s", dir, name);
+      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+```
+
+Update `buf2` to `PATH_MAX+20` similar to `buf`, thus giving enough
+headroom for the filename suffix.
+
+Signed-off-by: Kanak Shilledar <kanak.shilledar@axis.com>
+---
+ support/kconfig/util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/support/kconfig/util.c b/support/kconfig/util.c
+index 8665f5bb89..c2e7979ac1 100644
+--- a/support/kconfig/util.c
++++ b/support/kconfig/util.c
+@@ -35,7 +35,7 @@ struct file *file_lookup(const char *name)
+ int file_write_dep(const char *name)
+ {
+ 	char *str;
+-	char buf[PATH_MAX+20], buf2[PATH_MAX+1], dir[PATH_MAX+1];
++	char buf[PATH_MAX+20], buf2[PATH_MAX+20], dir[PATH_MAX+1];
+ 	struct symbol *sym, *env_sym;
+ 	struct expr *e;
+ 	struct file *file;
+-- 
+2.43.0
+
diff --git a/support/kconfig/patches/series b/support/kconfig/patches/series
index cc176035be..ca2193e734 100644
--- a/support/kconfig/patches/series
+++ b/support/kconfig/patches/series
@@ -12,3 +12,4 @@ 
 21-Avoid-false-positive-matches-from-comment-lines.patch
 22-kconfig-lxdialog-fix-check-with-GCC14.patch
 23-kconfig-mn-conf-handle-backspace-H-key.patch
+24-support-kconfig-Fix-compiler-warnings.patch