From: "J. Neuschäfer" <j.ne@posteo.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: j.ne@posteo.net, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/9] usb: storage: Mark various arrays as const
Date: Wed, 26 Feb 2025 17:43:45 +0000 [thread overview]
Message-ID: <Z79S0Uzxx9VJM5tY@probook> (raw)
In-Reply-To: <ea5c2735-cfb3-4e5f-a7f9-40d4493bd05a@rowland.harvard.edu>
On Wed, Feb 26, 2025 at 12:02:02PM -0500, Alan Stern wrote:
> On Wed, Feb 26, 2025 at 03:17:22PM +0100, 'Jonathan Neuschäfer via B4 Relay' via USB Mass Storage on Linux wrote:
> > While reading code, I noticed that some arrays in USB mass storage
> > drivers are declared static but not const, even though they are not
> > modified. This patchset marks them const.
> >
> > All patches were compile-tested.
> >
> > Signed-off-by: Jonathan Neuschäfer <j.ne@posteo.net>
> > ---
> > Changes in v2:
> > - Add new patches 2-9
> > - Use consistent authorship information
> > - Link to v1: https://lore.kernel.org/r/20250225-misc-const-v1-1-121ff3b86437@posteo.net
>
> The patches themselves look good, but I still think you should explain
> in the patch descriptions why declaring these arrays const is worth
> doing.
>
> Merely saying _what_ you are doing isn't good enough. We can tell what
> a patch does just by reading it. What we can't always tell is _why_ you
> would want to do it. That is what needs to be explained.
>
> The explanation doesn't have to be terribly long or detailed, but you
> should not omit it entirely.
Fair enough, I'll add such explanations to the patches.
Roughly, my motivations are:
- Moving data to read-only memory can prevent unintended modifications
and the hard-to-debug issue that might follow
- Const makes it easier for human readers to know what to expect
Best regards
prev parent reply other threads:[~2025-02-26 17:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 14:17 [PATCH v2 0/9] usb: storage: Mark various arrays as const Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 1/9] usb: storage: jumpshot: Use const for constant arrays Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 2/9] usb: storage: transport: Use const for constant array Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 3/9] usb: storage: alauda: Use const for card ID array Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 4/9] usb: storage: datafab: Use const for constant arrays Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 5/9] usb: storage: initializers: Use const for constant array Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 6/9] usb: storage: realtek_cr: Use const for constant arrays Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 7/9] usb: storage: sddr09: " Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 8/9] usb: storage: sddr55: " Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 14:17 ` [PATCH v2 9/9] usb: storage: shuttle_usbat: Use const for constant array Jonathan Neuschäfer
2025-02-26 14:17 ` Jonathan Neuschäfer via B4 Relay
2025-02-26 17:02 ` [PATCH v2 0/9] usb: storage: Mark various arrays as const Alan Stern
2025-02-26 17:43 ` J. Neuschäfer [this message]
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=Z79S0Uzxx9VJM5tY@probook \
--to=j.ne@posteo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.