[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 12 Dec 2023 15:05:19 -0800
From: Jesse Brandeburg <jesse.brandeburg@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, Kunwu Chan <chentao@...inos.cn>
CC: <anthony.l.nguyen@...el.com>, <davem@...emloft.net>,
<edumazet@...gle.com>, <pabeni@...hat.com>, <jacob.e.keller@...el.com>,
<przemyslaw.kitszel@...el.com>, <intel-wired-lan@...ts.osuosl.org>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Kunwu Chan
<kunwu.chan@...mail.com>
Subject: Re: [PATCH] iavf: Fix null pointer dereference in
iavf_print_link_message
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
> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:60: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:17: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 13
However the original warnings were for "%s" in strings. There should be
a good way, but I don't know it so could use some help.
-Jesse
Powered by blists - more mailing lists