[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024111251-spill-hatchback-72da@gregkh>
Date: Tue, 12 Nov 2024 16:14:17 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Sabyrzhan Tasbolatov <snovitoll@...il.com>
Cc: linux-usb@...r.kernel.org, andreyknvl@...il.com,
stern@...land.harvard.edu, b-liu@...com, johan@...nel.org,
oneukum@...e.com, linux-kernel@...r.kernel.org,
usb-storage@...ts.one-eyed-alien.net
Subject: Re: [PATCH] drivers/usb: refactor min(), max() with min_t(), max_t()
On Tue, Nov 12, 2024 at 08:04:37PM +0500, Sabyrzhan Tasbolatov wrote:
> Scanned the current drivers/usb code with `max\(.*\(` and `min\(.*\(`
> regexp queries to find casting inside of min() and max() which
> may lead to subtle bugs or even security vulnerabilities,
> especially if negative values are involved.
>
> Let's refactor to min_t() and max_t() specifying the data type
> to ensure it's applicable for the both compareable arguments.
> It should address potential type promotion issues and improves type safety.
>
> Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@...il.com>
> ---
> drivers/usb/core/config.c | 2 +-
> drivers/usb/gadget/composite.c | 12 ++++++------
> drivers/usb/gadget/configfs.c | 2 +-
> drivers/usb/gadget/function/f_fs.c | 6 +++---
> drivers/usb/gadget/function/f_mass_storage.c | 8 ++++----
> drivers/usb/gadget/function/uvc_video.c | 4 ++--
> drivers/usb/gadget/legacy/raw_gadget.c | 4 ++--
> drivers/usb/gadget/udc/omap_udc.c | 4 ++--
> drivers/usb/gadget/usbstring.c | 2 +-
> drivers/usb/host/ehci-hcd.c | 2 +-
> drivers/usb/host/oxu210hp-hcd.c | 4 ++--
> drivers/usb/host/r8a66597-hcd.c | 2 +-
> drivers/usb/misc/usbtest.c | 3 ++-
> drivers/usb/mon/mon_bin.c | 2 +-
> drivers/usb/musb/musb_core.c | 2 +-
> drivers/usb/musb/musb_gadget_ep0.c | 2 +-
> drivers/usb/musb/musb_host.c | 5 ++---
> drivers/usb/serial/io_edgeport.c | 2 +-
> drivers/usb/serial/sierra.c | 2 +-
> drivers/usb/storage/sddr09.c | 4 ++--
> drivers/usb/storage/sddr55.c | 8 ++++----
> 21 files changed, 41 insertions(+), 41 deletions(-)
Can you break these up to at least "one per drivers/usb/*" subdirectory
to make it easier to review and apply?
thanks,
greg k-h
Powered by blists - more mailing lists