[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <86cd2c99-7006-4ce1-abb1-8fe5e535fedb@lunn.ch>
Date: Wed, 12 Feb 2025 14:49:38 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Wentao Liang <vulab@...as.ac.cn>
Cc: Steen.Hegelund@...rochip.com, daniel.machon@...rochip.com,
UNGLinuxDriver@...rochip.com, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, linux-arm-kernel@...ts.infradead.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] net: microchip: sparx5: Fix potential NULL pointer
dereference in debugfs
On Wed, Feb 12, 2025 at 05:18:46PM +0800, Wentao Liang wrote:
> In vcap_debugfs_show_rule_keyset(), the function vcap_keyfields()
> returns a NULL pointer upon allocation failure.
/* Return the list of keyfields for the keyset */
const struct vcap_field *vcap_keyfields(struct vcap_control *vctrl,
enum vcap_type vt,
enum vcap_keyfield_set keyset)
{
/* Check that the keyset exists in the vcap keyset list */
if (keyset >= vctrl->vcaps[vt].keyfield_set_size)
return NULL;
return vctrl->vcaps[vt].keyfield_set_map[keyset];
}
I don't see any allocations here which can fail. I do agree it can
return NULL thought. So you code change looks correct, but you commit
message is broken.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists