public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Selvarasu Ganesan <selvarasu.g@samsung.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: mathias.nyman@intel.com, WeitaoWang-oc@zhaoxin.com,
	Thinh.Nguyen@synopsys.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, jh0801.jung@samsung.com,
	dh10.jung@samsung.com, naushad@samsung.com, akash.m5@samsung.com,
	h10.kim@samsung.com, eomji.oh@samsung.com,
	alim.akhtar@samsung.com, thiagu.r@samsung.com,
	muhammed.ali@samsung.com, pritam.sutar@samsung.com,
	cpgs@samsung.com, stable@vger.kernel.org
Subject: Re: [PATCH v2 2/2] usb: xhci: Fix unassigned variable 'bcdUSB' in xhci_create_usb3x_bos_desc()
Date: Mon, 17 Feb 2025 12:19:51 +0530	[thread overview]
Message-ID: <1997287019.61739775783590.JavaMail.epsvc@epcpadp2new> (raw)
In-Reply-To: <2025021402-cruelty-dumpster-57cc@gregkh>


On 2/14/2025 1:35 PM, Greg KH wrote:
> On Thu, Feb 13, 2025 at 09:51:26AM +0530, Selvarasu Ganesan wrote:
>> Fix the following smatch error:
>> drivers/usb/host/xhci-hub.c:71 xhci_create_usb3x_bos_desc() error: unassigned variable 'bcdUSB'
> That really doesn't say what is happening here at all.  Please provide a
> lot more information as the response from a tool could, or could not, be
> a real issue, how are we supposed to know?
>
> And "unassigned" really isn't the bug that is being fixed here, please
> describe it better.
>
> Same for patch 2 of the series.
>
> Also, your 0/2 email was not threaded with these patches, something odd
> happened in your email setup, you might want to look into that.
>
> thanks,
>
> greg k-h
>

Hi Greg,

I understand your concern about whether the response from the tool could 
be a real issue or not. However, please check the provided code, I 
believe there is an issue worth considering.
In both conditions of the code snippet, the logical check is not valid 
because the 'bcdUSB' variable has not been assigned any value initially. 
Therefore, we believe that the tool is correctly identifying this problem.

If you do not consider it an issue, we can ignore this commit.


Please find the relevant portion of the code below:

========================================================================
u16                             bcdUSB;
...
...
/* Create the descriptor for port with the highest revision */
for (i = 0; i < xhci->num_port_caps; i++) {
     ..
     ..
*  if (i == 0 || bcdUSB < rev) { *
         bcdUSB = rev;
         port_cap = &xhci->port_caps[i];
     }
}
..
..
*if (bcdUSB >= 0x0310) {* //*Logically invalid to check bcdUSB without 
assigning a valuewhere above **xhci->num_port_caps become NULL*.
     if (port_cap->psi_count) {

         u8 num_sym_ssa = 0;

=======================================================================


yeah some issue in ouremail setup. We will fix it.



  reply	other threads:[~2025-02-17  7:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250213042229epcas5p1a3080b21423a43f2e71ab7f631604b1d@epcas5p1.samsung.com>
     [not found] ` <20250213042130.858-1-selvarasu.g@samsung.com>
2025-02-13  4:21   ` [PATCH v2 1/2] usb: xhci: Fix unassigned variable 'tmp_minor_revision' in xhci_add_in_port() Selvarasu Ganesan
2025-02-13  4:21   ` [PATCH v2 2/2] usb: xhci: Fix unassigned variable 'bcdUSB' in xhci_create_usb3x_bos_desc() Selvarasu Ganesan
2025-02-14  8:05     ` Greg KH
2025-02-17  6:49       ` Selvarasu Ganesan [this message]
2025-02-17  7:17         ` Greg KH

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=1997287019.61739775783590.JavaMail.epsvc@epcpadp2new \
    --to=selvarasu.g@samsung.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=WeitaoWang-oc@zhaoxin.com \
    --cc=akash.m5@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=dh10.jung@samsung.com \
    --cc=eomji.oh@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=h10.kim@samsung.com \
    --cc=jh0801.jung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=muhammed.ali@samsung.com \
    --cc=naushad@samsung.com \
    --cc=pritam.sutar@samsung.com \
    --cc=stable@vger.kernel.org \
    --cc=thiagu.r@samsung.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