Message ID | 158453976.61739422383216.JavaMail.epsvc@epcpadp2new (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Fix unassigned variables in xhci driver | expand |
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
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.
On Mon, Feb 17, 2025 at 12:19:51PM +0530, Selvarasu Ganesan wrote: > > 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. I am not disagreeing that this is a real issue that should be fixed (but confused as to why the normal compilers are not catching this, which implies that maybe it never can actually be hit). So please fix up your changelog text and I will be glad to review it. thanks, greg k-h
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 9693464c0520..5715a8bdda7f 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -39,7 +39,7 @@ static int xhci_create_usb3x_bos_desc(struct xhci_hcd *xhci, char *buf, struct usb_ss_cap_descriptor *ss_cap; struct usb_ssp_cap_descriptor *ssp_cap; struct xhci_port_cap *port_cap = NULL; - u16 bcdUSB; + u16 bcdUSB = 0; u32 reg; u32 min_rate = 0; u8 min_ssid;
Fix the following smatch error: drivers/usb/host/xhci-hub.c:71 xhci_create_usb3x_bos_desc() error: unassigned variable 'bcdUSB' Fixes: eb02aaf21f29 ("usb: xhci: Rewrite xhci_create_usb3_bos_desc()") Cc: stable@vger.kernel.org Signed-off-by: Selvarasu Ganesan <selvarasu.g@samsung.com> --- drivers/usb/host/xhci-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)