On Tue, 12 Dec 2023 15:05:19 -0800 Jesse Brandeburg wrote: > On 12/12/2023 1:28 PM, Jakub Kicinski wrote: > > On Mon, 11 Dec 2023 10:59:27 +0800 Kunwu Chan wrote: > >> kasprintf() returns a pointer to dynamically allocated memory > >> which can be NULL upon failure. > >> > >> Fixes: 1978d3ead82c ("intel: fix string truncation warnings") > > > > No need for the allocation here, print to a buffer on the stack. > > Sure, but I think that just takes us full circle back to where we > started. reverting this to the previous code will add back W=1 warnings. > > The whole point of the commit mentioned above was to get a reasonable > implementation that won't cause string truncation warnings. Is there > some trick I don't know about to get an allocation which will not > trigger snprintf and friends to print warnings from -Wformat-truncation
Hm, it'd be nice if there was a flavor of snprintf which explicitly doesn't trigger this warning. Or perhaps a marking for the output buffer that says "truncation OK". Absent that, can we print to a buffer on the stack and copy? The link message is probably meh, but automation may get quite confused if a NIC suddenly stops reporting FW version.. _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan