diff mbox series

[2/2] usb: host: uhci: remove #define EXTRA_SPACE

Message ID 20220312202834.11700-3-s.shtylyov@omp.ru
State New
Headers show
Series Switch to using scnprintf() in the UHCI driver's debugging code | expand

Commit Message

Sergey Shtylyov March 12, 2022, 8:28 p.m. UTC
The UHCI driver's debugging code used a lot of sprintf() calls with the
large buffers, leaving 1024 bytes at the end of the buffers to handle
buffer overflow. As that code was changed to call scnprintf() instead,
there's no more buffer overflow, so we don't need #define EXTRA_SPACE
anymore...

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/usb/host/uhci-debug.c | 5 +----
 drivers/usb/host/uhci-hcd.c   | 2 +-
 drivers/usb/host/uhci-q.c     | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index b5425dbd3e2d..db854b41dcb9 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -17,8 +17,6 @@ 
 
 #include "uhci-hcd.h"
 
-#define EXTRA_SPACE	1024
-
 static struct dentry *uhci_debugfs_root;
 
 #ifdef CONFIG_DYNAMIC_DEBUG
@@ -496,8 +494,7 @@  static int uhci_debug_open(struct inode *inode, struct file *file)
 	up->size = 0;
 	spin_lock_irqsave(&uhci->lock, flags);
 	if (uhci->is_initialized)
-		up->size = uhci_sprint_schedule(uhci, up->data,
-					MAX_OUTPUT - EXTRA_SPACE);
+		up->size = uhci_sprint_schedule(uhci, up->data, MAX_OUTPUT);
 	spin_unlock_irqrestore(&uhci->lock, flags);
 
 	file->private_data = up;
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index d90b869f5f40..9ebe6f32c1d9 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -480,7 +480,7 @@  static irqreturn_t uhci_irq(struct usb_hcd *hcd)
 				if (debug > 1 && errbuf) {
 					/* Print the schedule for debugging */
 					uhci_sprint_schedule(uhci, errbuf,
-						ERRBUF_LEN - EXTRA_SPACE);
+						ERRBUF_LEN);
 					lprintk(errbuf);
 				}
 				uhci_hc_died(uhci);
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 35fcb826152c..34cce3ee2bb3 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -1199,7 +1199,7 @@  static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
 				if (debug > 1 && errbuf) {
 					/* Print the chain for debugging */
 					uhci_show_qh(uhci, urbp->qh, errbuf,
-						ERRBUF_LEN - EXTRA_SPACE, 0);
+						ERRBUF_LEN, 0);
 					lprintk(errbuf);
 				}
 			}