[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZDUin+kC2Zrqk2wk@corigine.com>
Date: Tue, 11 Apr 2023 11:04:31 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Pavan Kumar Linga <pavan.kumar.linga@...el.com>
Cc: intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
emil.s.tantilov@...el.com, joshua.a.hay@...el.com,
sridhar.samudrala@...el.com, jesse.brandeburg@...el.com,
anthony.l.nguyen@...el.com, willemb@...gle.com, decot@...gle.com,
pabeni@...hat.com, kuba@...nel.org, edumazet@...gle.com,
davem@...emloft.net, Alan Brady <alan.brady@...el.com>,
Madhu Chittim <madhu.chittim@...el.com>,
Phani Burra <phani.r.burra@...el.com>,
Shailendra Bhatnagar <shailendra.bhatnagar@...el.com>
Subject: Re: [PATCH net-next v2 06/15] idpf: continue expanding init task
On Mon, Apr 10, 2023 at 06:13:45PM -0700, Pavan Kumar Linga wrote:
...
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
...
> +/**
> + * idpf_send_get_rx_ptype_msg - Send virtchnl for ptype info
> + * @vport: virtual port data structure
> + *
> + * Returns 0 on success, negative on failure.
> + */
> +int idpf_send_get_rx_ptype_msg(struct idpf_vport *vport)
> +{
...
> + while (ptypes_recvd < max_ptype) {
> + err = idpf_wait_for_event(adapter, NULL, IDPF_VC_GET_PTYPE_INFO,
> + IDPF_VC_GET_PTYPE_INFO_ERR);
> + if (err)
> + goto get_ptype_rel;
> +
> + len = IDPF_DFLT_MBX_BUF_SIZE;
> + ptype_info = kcalloc(1, len, GFP_KERNEL);
> + if (!ptype_info) {
> + err = -ENOMEM;
> + goto clear_vc_flag;
> + }
> +
> + memcpy(ptype_info, adapter->vc_msg, len);
> +
> + ptypes_recvd += le16_to_cpu(ptype_info->num_ptypes);
> + if (ptypes_recvd > max_ptype) {
> + err = -EINVAL;
> + goto ptype_rel;
> + }
> +
> + ptype_offset = sizeof(struct virtchnl2_get_ptype_info);
> +
> + for (i = 0; i < le16_to_cpu(ptype_info->num_ptypes); i++) {
> + struct idpf_ptype_state pstate = { };
> + struct virtchnl2_ptype *ptype;
> + u16 id;
> +
> + ptype = (struct virtchnl2_ptype *)
> + ((u8 *)ptype_info + ptype_offset);
> +
> + ptype_offset += IDPF_GET_PTYPE_SIZE(ptype);
> + if (ptype_offset > len) {
> + err = -EINVAL;
> + goto ptype_rel;
> + }
> +
> + if (le16_to_cpu(ptype->ptype_id_10) ==
> + IDPF_INVALID_PTYPE_ID)
> + goto ptype_rel;
Hi Pavan,
The ptype_rel label will return err.
But err is 0 here. Perhaps it should be set to a negative error code?
Flagged by Smatch as:
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c:1198 idpf_send_get_rx_ptype_msg() warn: missing error code 'err'
...
> + kfree(get_ptype_info);
> +
> + return 0;
> +
> +ptype_rel:
> + kfree(ptype_info);
> +clear_vc_flag:
> + clear_bit(__IDPF_VC_MSG_PENDING, adapter->flags);
> +get_ptype_rel:
> + kfree(get_ptype_info);
> +
> + return err;
> +}
...
Powered by blists - more mailing lists