mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: shuah <shuah@kernel.org>
To: Suwan Kim <suwan.kim027@gmail.com>, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	dan.carpenter@oracle.com, valentina.manea.m@gmail.com,
	kbuild test robot <lkp@intel.com>, shuah <shuah@kernel.org>
Subject: Re: [PATCH] usbip: Fix uninitialized symbol 'nents' in stub_recv_cmd_submit()
Date: Tue, 12 Nov 2019 02:41:08 -0700	[thread overview]
Message-ID: <270931e3-c859-a0fd-67f5-35d83ef6e5e9@kernel.org> (raw)
In-Reply-To: <20191111141035.27788-1-suwan.kim027@gmail.com>

On 11/11/19 7:10 AM, Suwan Kim wrote:
> Smatch reported that nents is not initialized and used in
> stub_recv_cmd_submit(). nents is currently initialized by sgl_alloc()
> and used to allocate multiple URBs when host controller doesn't
> support scatter-gather DMA. The use of uninitialized nents means that
> buf_len is zero and use_sg is true. But buffer length should not be
> zero when an URB uses scatter-gather DMA.
> 
> To prevent this situation, add the conditional that checks buf_len
> and use_sg. And move the use of nents right after the sgl_alloc() to
> avoid the use of uninitialized nents.
> 
> If the error occurs, it adds SDEV_EVENT_ERROR_MALLOC and stub_priv
> will be released by stub event handler and connection will be shut
> down.
> 
> Fixes: ea44d190764b ("usbip: Implement SG support to vhci-hcd and stub driver")
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
> ---

Looks good.

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

thanks,
-- Shuah


      reply	other threads:[~2019-11-12  9:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-11 14:10 Suwan Kim
2019-11-12  9:41 ` 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=270931e3-c859-a0fd-67f5-35d83ef6e5e9@kernel.org \
    --to=shuah@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lkp@intel.com \
    --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®