linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: KMSAN: uninit-value in alauda_check_media
@ 2023-08-02 16:05 Alan Stern
  2023-08-02 16:05 ` syzbot
  2023-08-02 17:01 ` [syzbot] [usb?] [usb-storage?] " syzbot
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Stern @ 2023-08-02 16:05 UTC (permalink / raw)
  To: syzbot; +Cc: Christophe JAILLET, USB mailing list

This thread has been dormant for over a year and a half.  Let's revive 
it and try to close out the issue.

Alan Stern

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ v6.5-rc3

Index: usb-devel/drivers/usb/storage/alauda.c
===================================================================
--- usb-devel.orig/drivers/usb/storage/alauda.c
+++ usb-devel/drivers/usb/storage/alauda.c
@@ -318,7 +318,8 @@ static int alauda_get_media_status(struc
 	rc = usb_stor_ctrl_transfer(us, us->recv_ctrl_pipe,
 		command, 0xc0, 0, 1, data, 2);
 
-	usb_stor_dbg(us, "Media status %02X %02X\n", data[0], data[1]);
+	if (rc == USB_STOR_XFER_GOOD)
+		usb_stor_dbg(us, "Media status %02X %02X\n", data[0], data[1]);
 
 	return rc;
 }
@@ -454,9 +455,14 @@ static int alauda_init_media(struct us_d
 static int alauda_check_media(struct us_data *us)
 {
 	struct alauda_info *info = (struct alauda_info *) us->extra;
-	unsigned char status[2];
+	unsigned char *status = us->iobuf;
+	int rc;
 
-	alauda_get_media_status(us, status);
+	rc = alauda_get_media_status(us, status);
+	if (rc != USB_STOR_XFER_GOOD) {
+		status[0] = 0xF0;	/* Pretend there's no media */
+		status[1] = 0;
+	}
 
 	/* Check for no media or door open */
 	if ((status[0] & 0x80) || ((status[0] & 0x1F) == 0x10)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-02 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 16:05 KMSAN: uninit-value in alauda_check_media Alan Stern
2023-08-02 16:05 ` syzbot
2023-08-02 16:35   ` Alan Stern
2023-08-02 17:01 ` [syzbot] [usb?] [usb-storage?] " syzbot
2023-08-02 17:49   ` [PATCH] usb-storage: alauda: Fix uninit-value in alauda_check_media() Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).