Subject: Re: [PATCH net-next v10 2/9] hinic3: Add PF management interfaces

From: Jakub Kicinski <[email-masked]>
Date: Fri, 9 Jan 2026 06:23:42 -0800

On Fri, 9 Jan 2026 10:35:52 +0800 Fan Gong wrote:
> +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;
> +		}
> +		memcpy(mgmt_work->msg, recv_msg->msg, recv_msg->msg_len);

coccicheck says:

drivers/net/ethernet/huawei/hinic3/hinic3_mgmt.c:128:19-26: WARNING opportunity for kmemdup
-- 
pw-bot: cr