mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: shuah <shuah@kernel.org>
To: Suwan Kim <suwan.kim027@gmail.com>,
	valentina.manea.m@gmail.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	shuah <shuah@kernel.org>, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] usbip: Replace unused kvec array with single variable in vhci_send_cmd_unlink()
Date: Mon, 3 Jun 2019 18:56:52 -0600	[thread overview]
Message-ID: <cff86084-5b7b-c02e-69d5-3e0e801fd11f@kernel.org> (raw)
In-Reply-To: <20190603150211.24926-1-suwan.kim027@gmail.com>

On 6/3/19 9:02 AM, Suwan Kim wrote:
> vhci_send_cmd_unlink() declears kvec array of size 3 but it actually
> uses just one element of the array. So, remove kvec array and replace
> it with single kvec variable.
> 
> Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
> ---
>   drivers/usb/usbip/vhci_tx.c | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/usbip/vhci_tx.c b/drivers/usb/usbip/vhci_tx.c
> index 9aed15a358b7..2fa26d0578d7 100644
> --- a/drivers/usb/usbip/vhci_tx.c
> +++ b/drivers/usb/usbip/vhci_tx.c
> @@ -144,16 +144,14 @@ static int vhci_send_cmd_unlink(struct vhci_device *vdev)
>   	struct vhci_unlink *unlink = NULL;
>   
>   	struct msghdr msg;
> -	struct kvec iov[3];
> +	struct kvec iov;
>   	size_t txsize;
> -
>   	size_t total_size = 0;
>   
>   	while ((unlink = dequeue_from_unlink_tx(vdev)) != NULL) {
>   		int ret;
>   		struct usbip_header pdu_header;
>   
> -		txsize = 0;
>   		memset(&pdu_header, 0, sizeof(pdu_header));
>   		memset(&msg, 0, sizeof(msg));
>   		memset(&iov, 0, sizeof(iov));
> @@ -169,11 +167,11 @@ static int vhci_send_cmd_unlink(struct vhci_device *vdev)
>   
>   		usbip_header_correct_endian(&pdu_header, 1);
>   
> -		iov[0].iov_base = &pdu_header;
> -		iov[0].iov_len  = sizeof(pdu_header);
> -		txsize += sizeof(pdu_header);
> +		iov.iov_base = &pdu_header;
> +		iov.iov_len  = sizeof(pdu_header);
> +		txsize = sizeof(pdu_header);
>   
> -		ret = kernel_sendmsg(vdev->ud.tcp_socket, &msg, iov, 1, txsize);
> +		ret = kernel_sendmsg(vdev->ud.tcp_socket, &msg, &iov, 1, txsize);
>   		if (ret != txsize) {
>   			pr_err("sendmsg failed!, ret=%d for %zd\n", ret,
>   			       txsize);
> 

Looks good to me.

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

      reply	other threads:[~2019-06-04  0:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 15:02 Suwan Kim
2019-06-04  0:56 ` shuah [this message]

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=cff86084-5b7b-c02e-69d5-3e0e801fd11f@kernel.org \
    --to=shuah@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=suwan.kim027@gmail.com \
    --cc=valentina.manea.m@gmail.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®