Linux USB
 help / color / mirror / Atom feed
From: <frans@biabv.com>
To: <linux-usb@vger.kernel.org>
Subject: tools/usb/usbip reports errors based on uninitialized value
Date: Fri, 19 Aug 2022 15:53:36 +0200	[thread overview]
Message-ID: <02c301d8b3d3$17a4d760$46ee8620$@biabv.com> (raw)

Consider handling the 'usbip list' command:

Here an uninitialized 'status' variable is declared:
https://github.com/torvalds/linux/blob/master/tools/usb/usbip/src/usbip_list
.c#L54

'status' is provided as an output variable here:
https://github.com/torvalds/linux/blob/master/tools/usb/usbip/src/usbip_list
.c#L62

However, 'usbip_net_recv_op_common' (defined here:
https://github.com/torvalds/linux/blob/master/tools/usb/usbip/src/usbip_netw
ork.c#L162) can fail and return for several reasons before setting 'status'.

The caller uses 'status' (which is still uninitialized) to report an error
text here:
https://github.com/torvalds/linux/blob/master/tools/usb/usbip/src/usbip_list
.c#L65

This leads to random error messages. Sometimes the accidental value of
status maps to a specific error text (which is not informative about the
actual error), but most of the times it will lead to "Unknown Op Common
Status".

F.


             reply	other threads:[~2022-08-19 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 13:53 frans [this message]
2022-08-19 15:34 ` tools/usb/usbip reports errors based on uninitialized value 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='02c301d8b3d3$17a4d760$46ee8620$@biabv.com' \
    --to=frans@biabv.com \
    --cc=linux-usb@vger.kernel.org \
    /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