[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ae686e04-b65c-4a4d-b208-076136bae070@kylinos.cn>
Date: Thu, 14 Dec 2023 14:46:06 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: Jakub Kicinski <kuba@...nel.org>
Cc: jesse.brandeburg@...el.com, 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
Thanks for your reply.
Sure, the only thing 'iavf_print_link_message' do is to print a msg by
netdev_info.
The 'iavf_virtchnl_completion' assume that no errors will be returned.
Whether we could just execute 'netdev_info(netdev, "NIC Link is Up Speed
is %s Full Duplex\n", speed? speed :"");' when 'speed' is null.
Before commit '1978d3ead82c8', the buffer size is '#define
IAVF_MAX_SPEED_STRLEN 13', whether we could use a bigger buffer
size to avoid a null pointer.
Such as '#define IAVF_MAX_SPEED_STRLEN 48'.
On 2023/12/13 05:28, 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.
Powered by blists - more mailing lists