lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 11 Apr 2023 11:52:25 +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 04/15] idpf: add core init and interrupt
 request

On Mon, Apr 10, 2023 at 06:13:43PM -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_recv_get_caps_msg - Receive virtchnl get capabilities message
> + * @adapter: Driver specific private structure
> + *
> + * Receive virtchnl get capabilities message. Returns 0 on success, negative on
> + * failure.
> + */
> +static int idpf_recv_get_caps_msg(struct idpf_adapter *adapter)
> +{
> +	return idpf_recv_mb_msg(adapter, VIRTCHNL2_OP_GET_CAPS, &adapter->caps,
> +				sizeof(struct virtchnl2_get_capabilities));
> +}
> +
> +/**
> + * idpf_send_alloc_vectors_msg - Send virtchnl alloc vectors message
> + * @adapter: Driver specific private structure
> + * @num_vectors: number of vectors to be allocated
> + *
> + * Returns 0 on success, negative on failure.
> + */
> +int idpf_send_alloc_vectors_msg(struct idpf_adapter *adapter, u16 num_vectors)
> +{
> +	struct virtchnl2_alloc_vectors *alloc_vec, *rcvd_vec;
> +	struct virtchnl2_alloc_vectors ac = { };
> +	u16 num_vchunks;
> +	int size, err;
> +
> +	ac.num_vectors = cpu_to_le16(num_vectors);
> +
> +	err = idpf_send_mb_msg(adapter, VIRTCHNL2_OP_ALLOC_VECTORS,
> +			       sizeof(ac), (u8 *)&ac);
> +	if (err)
> +		return err;
> +
> +	err = idpf_wait_for_event(adapter, NULL, IDPF_VC_ALLOC_VECTORS,
> +				  IDPF_VC_ALLOC_VECTORS_ERR);
> +	if (err)
> +		return err;
> +
> +	rcvd_vec = (struct virtchnl2_alloc_vectors *)adapter->vc_msg;
> +	num_vchunks = le16_to_cpu(rcvd_vec->vchunks.num_vchunks);
> +
> +	size = struct_size(rcvd_vec, vchunks.vchunks, num_vchunks);
> +	if (size > sizeof(adapter->vc_msg)) {
> +		err = -EINVAL;
> +		goto error;
> +	}
> +
> +	kfree(adapter->req_vec_chunks);
> +	adapter->req_vec_chunks = NULL;
> +	adapter->req_vec_chunks = kzalloc(size, GFP_KERNEL);
> +	if (!adapter->req_vec_chunks) {
> +		err = -ENOMEM;
> +		goto error;
> +	}
> +	memcpy(adapter->req_vec_chunks, adapter->vc_msg, size);

Hi Pavan,

Coccinelle suggests that kmemdup might be used here.

drivers/net/ethernet/intel/idpf/idpf_virtchnl.c:2085:27-34: WARNING opportunity for kmemdup

Likewise for a similar pattern in:
* [PATCH net-next v2 14/15] idpf: add ethtool callbacks

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ