mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fan Gong <gongfan1@huawei.com>
To: <gongfan1@huawei.com>
Cc: <Markus.Elfring@web.de>, <alok.a.tiwari@oracle.com>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <guoxin09@huawei.com>, <horms@kernel.org>,
	<kuba@kernel.org>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <luosifu@huawei.com>,
	<luoyang82@h-partners.com>, <netdev@vger.kernel.org>,
	<pabeni@redhat.com>, <pavan.chebbi@broadcom.com>,
	<shijing34@huawei.com>, <wulike1@huawei.com>,
	<zhoushuai28@huawei.com>, <zhuyikai1@h-partners.com>
Subject: Re: [PATCH net-next v09 2/9] hinic3: Add PF management interfaces
Date: Wed, 7 Jan 2026 11:14:13 +0800	[thread overview]
Message-ID: <20260107031413.941-1-gongfan1@huawei.com> (raw)
In-Reply-To: <155d1e55a0ad8f1cef1fd223da28bc39b4ed6abf.1767707500.git.zhuyikai1@h-partners.com>

> > +static void hinic3_init_mgmt_msg_work(struct hinic3_msg_pf_to_mgmt *pf_to_mgmt,
> > +				      struct hinic3_recv_msg *recv_msg)
> > +{
> > +	struct mgmt_msg_handle_work *mgmt_work;
> > +
> > +	mgmt_work = kmalloc(sizeof(*mgmt_work), GFP_KERNEL);
> > +	if (!mgmt_work)
> > +		return;
> > +
> > +	if (recv_msg->msg_len) {
> > +		mgmt_work->msg = kmalloc(recv_msg->msg_len, GFP_KERNEL);
> > +		if (!mgmt_work->msg) {
> > +			kfree(mgmt_work);
> > +			return;
> > +		}
> > +	}
> 
> When recv_msg->msg_len is zero, the above conditional is not taken, leaving
> mgmt_work->msg uninitialized. The work handler later calls kfree() on this
> uninitialized pointer at the "out" label in hinic3_recv_mgmt_msg_work_handler().
> 
> A zero-length message can arrive when seg_len is 0 in hinic3_recv_msg_add_seg(),
> which only validates seg_len > MGMT_SEG_LEN_MAX but does not reject seg_len == 0.
> 
> Should mgmt_work->msg be initialized to NULL before the conditional, or should
> an else clause set it to NULL?

We will address the AI review comments in patch 2/5/8 sooner.

  reply	other threads:[~2026-01-07  3:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-07  1:04 [PATCH net-next v09 0/9] net: hinic3: PF initialization Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 1/9] hinic3: Add PF framework Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 2/9] hinic3: Add PF management interfaces Fan Gong
2026-01-07  3:14   ` Fan Gong [this message]
2026-01-07  1:04 ` [PATCH net-next v09 3/9] hinic3: Add .ndo_tx_timeout and .ndo_get_stats64 Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 4/9] hinic3: Add .ndo_set_features and .ndo_fix_features Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 5/9] hinic3: Add .ndo_features_check Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 6/9] hinic3: Add .ndo_vlan_rx_add/kill_vid and .ndo_validate_addr Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 7/9] hinic3: Add adaptive IRQ coalescing with DIM Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 8/9] hinic3: Add mac filter ops Fan Gong
2026-01-07  1:04 ` [PATCH net-next v09 9/9] hinic3: Add HW event handler Fan Gong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260107031413.941-1-gongfan1@huawei.com \
    --to=gongfan1@huawei.com \
    --cc=Markus.Elfring@web.de \
    --cc=alok.a.tiwari@oracle.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=guoxin09@huawei.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luosifu@huawei.com \
    --cc=luoyang82@h-partners.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=shijing34@huawei.com \
    --cc=wulike1@huawei.com \
    --cc=zhoushuai28@huawei.com \
    --cc=zhuyikai1@h-partners.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®