All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
To: Simon Horman <simon.horman@corigine.com>,
	Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
	<joshua.a.hay@intel.com>, <sridhar.samudrala@intel.com>,
	<jesse.brandeburg@intel.com>, <anthony.l.nguyen@intel.com>,
	<willemb@google.com>, <decot@google.com>, <pabeni@redhat.com>,
	<kuba@kernel.org>, <edumazet@google.com>, <davem@davemloft.net>,
	Alan Brady <alan.brady@intel.com>,
	Madhu Chittim <madhu.chittim@intel.com>,
	Phani Burra <phani.r.burra@intel.com>,
	Shailendra Bhatnagar <shailendra.bhatnagar@intel.com>
Subject: Re: [PATCH net-next v2 06/15] idpf: continue expanding init task
Date: Thu, 13 Apr 2023 12:04:47 -0700	[thread overview]
Message-ID: <ff27f4ba-9cdc-937a-2b1b-ad621adc26fa@intel.com> (raw)
In-Reply-To: <ZDUin+kC2Zrqk2wk@corigine.com>



On 4/11/2023 2:04 AM, Simon Horman wrote:
> 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'

We'll address this in v3 along with the other smatch related hits.

Thanks,
Emil

> ...
> 
>> +	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;
>> +}
> 
> ...

WARNING: multiple messages have this Message-ID (diff)
From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
To: Simon Horman <simon.horman@corigine.com>,
	Pavan Kumar Linga <pavan.kumar.linga@intel.com>
Cc: willemb@google.com, pabeni@redhat.com,
	Shailendra Bhatnagar <shailendra.bhatnagar@intel.com>,
	netdev@vger.kernel.org, jesse.brandeburg@intel.com,
	kuba@kernel.org, edumazet@google.com, anthony.l.nguyen@intel.com,
	intel-wired-lan@lists.osuosl.org,
	Phani Burra <phani.r.burra@intel.com>,
	decot@google.com, davem@davemloft.net
Subject: Re: [Intel-wired-lan] [PATCH net-next v2 06/15] idpf: continue expanding init task
Date: Thu, 13 Apr 2023 12:04:47 -0700	[thread overview]
Message-ID: <ff27f4ba-9cdc-937a-2b1b-ad621adc26fa@intel.com> (raw)
In-Reply-To: <ZDUin+kC2Zrqk2wk@corigine.com>



On 4/11/2023 2:04 AM, Simon Horman wrote:
> 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'

We'll address this in v3 along with the other smatch related hits.

Thanks,
Emil

> ...
> 
>> +	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;
>> +}
> 
> ...
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2023-04-13 19:04 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  1:13 [PATCH net-next v2 00/15] Introduce Intel IDPF driver Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11  1:13 ` [PATCH net-next v2 01/15] virtchnl: add virtchnl version 2 ops Pavan Kumar Linga
2023-04-11  1:13   ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11  8:51   ` Simon Horman
2023-04-11  8:51     ` [Intel-wired-lan] " Simon Horman
2023-04-12 21:38     ` Tantilov, Emil S
2023-04-12 21:38       ` [Intel-wired-lan] " Tantilov, Emil S
2023-04-11  1:13 ` [PATCH net-next v2 02/15] idpf: add module register and probe functionality Pavan Kumar Linga
2023-04-11  1:13   ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11 12:36   ` Leon Romanovsky
2023-04-11 12:36     ` [Intel-wired-lan] " Leon Romanovsky
2023-04-12 23:10     ` Tantilov, Emil S
2023-04-12 23:10       ` [Intel-wired-lan] " Tantilov, Emil S
2023-04-13  6:03       ` Leon Romanovsky
2023-04-13  6:03         ` [Intel-wired-lan] " Leon Romanovsky
2023-04-13 18:58         ` Tantilov, Emil S
2023-04-13 18:58           ` [Intel-wired-lan] " Tantilov, Emil S
2023-04-20 18:13       ` Tantilov, Emil S
2023-04-20 18:13         ` Tantilov, Emil S
2023-04-20 18:20         ` Leon Romanovsky
2023-04-20 18:20           ` Leon Romanovsky
2023-04-11  1:13 ` [PATCH net-next v2 03/15] idpf: add controlq init and reset checks Pavan Kumar Linga
2023-04-11  1:13   ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11  9:19   ` Simon Horman
2023-04-11  9:19     ` [Intel-wired-lan] " Simon Horman
2023-04-11  1:13 ` [PATCH net-next v2 04/15] idpf: add core init and interrupt request Pavan Kumar Linga
2023-04-11  1:13   ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11  9:52   ` Simon Horman
2023-04-11  9:52     ` [Intel-wired-lan] " Simon Horman
2023-04-13 19:10     ` Tantilov, Emil S
2023-04-13 19:10       ` [Intel-wired-lan] " Tantilov, Emil S
2023-04-11  1:13 ` [PATCH net-next v2 05/15] idpf: add create vport and netdev configuration Pavan Kumar Linga
2023-04-11  1:13   ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 06/15] idpf: continue expanding init task Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-11  9:04   ` [Intel-wired-lan] " Simon Horman
2023-04-11  9:04     ` Simon Horman
2023-04-13 19:04     ` Tantilov, Emil S [this message]
2023-04-13 19:04       ` [Intel-wired-lan] " Tantilov, Emil S
2023-04-11  1:13 ` [PATCH net-next v2 07/15] idpf: configure resources for TX queues Pavan Kumar Linga
2023-04-11  1:13   ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 08/15] idpf: configure resources for RX queues Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 09/15] idpf: initialize interrupts and enable vport Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 10/15] idpf: add splitq start_xmit Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-11  1:13 ` [PATCH net-next v2 11/15] idpf: add TX splitq napi poll support Pavan Kumar Linga
2023-04-11  1:13   ` [Intel-wired-lan] " Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 12/15] idpf: add RX " Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 13/15] idpf: add singleq start_xmit and napi poll Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 14/15] idpf: add ethtool callbacks Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-11  9:55   ` Simon Horman
2023-04-11  9:55     ` [Intel-wired-lan] " Simon Horman
2023-04-13 19:11     ` Tantilov, Emil S
2023-04-13 19:11       ` [Intel-wired-lan] " Tantilov, Emil S
2023-04-22  5:26       ` Tantilov, Emil S
2023-04-22  5:26         ` Tantilov, Emil S
2023-04-22  7:55         ` Simon Horman
2023-04-22  7:55           ` Simon Horman
2023-04-11  1:13 ` [Intel-wired-lan] [PATCH net-next v2 15/15] idpf: configure SRIOV and add other ndo_ops Pavan Kumar Linga
2023-04-11  1:13   ` Pavan Kumar Linga
2023-04-12 18:25 ` [Intel-wired-lan] [PATCH net-next v2 00/15] Introduce Intel IDPF driver Sasha Levin
2023-04-12 18:25   ` Sasha Levin
2023-04-12 19:16   ` Willem de Bruijn
2023-04-12 19:16     ` Willem de Bruijn
2023-04-13  0:03     ` Samudrala, Sridhar
2023-04-13  0:03       ` Samudrala, Sridhar
2023-04-13  2:24       ` Jakub Kicinski
2023-04-13  2:24         ` Jakub Kicinski
2023-04-13  7:15         ` Leon Romanovsky
2023-04-13  7:15           ` Leon Romanovsky
2023-04-14 22:01         ` Sasha Levin
2023-04-14 22:01           ` Sasha Levin
2023-04-14 22:27           ` Jakub Kicinski
2023-04-14 22:27             ` Jakub Kicinski
2023-04-15 17:16             ` Sasha Levin
2023-04-15 17:16               ` Sasha Levin
2023-04-17 16:38               ` Jakub Kicinski
2023-04-17 16:38                 ` Jakub Kicinski
2023-06-14 17:14 [PATCH net-next v2 00/15][pull request] " Tony Nguyen
2023-06-14 17:14 ` [PATCH net-next v2 06/15] idpf: continue expanding init task Tony Nguyen

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=ff27f4ba-9cdc-937a-2b1b-ad621adc26fa@intel.com \
    --to=emil.s.tantilov@intel.com \
    --cc=alan.brady@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=decot@google.com \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=joshua.a.hay@intel.com \
    --cc=kuba@kernel.org \
    --cc=madhu.chittim@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.kumar.linga@intel.com \
    --cc=phani.r.burra@intel.com \
    --cc=shailendra.bhatnagar@intel.com \
    --cc=simon.horman@corigine.com \
    --cc=sridhar.samudrala@intel.com \
    --cc=willemb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.