From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
linux-usb@vger.kernel.org, jthies@google.com,
pmalani@chromium.org, Neil Armstrong <neil.armstrong@linaro.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Fabrice Gasnier <fabrice.gasnier@foss.st.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Hans de Goede <hdegoede@redhat.com>,
Rajaram Regupathy <rajaram.regupathy@intel.com>,
Saranya Gopal <saranya.gopal@intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/3] usb: typec: ucsi: Limit read size on v1.2
Date: Fri, 9 Feb 2024 16:28:33 +0200 [thread overview]
Message-ID: <ZcY2kVlUn7SJ5pW8@smile.fi.intel.com> (raw)
In-Reply-To: <20240208220230.v4.1.Iacf5570a66b82b73ef03daa6557e2fc0db10266a@changeid>
On Thu, Feb 08, 2024 at 10:02:38PM -0800, Abhishek Pandit-Subedi wrote:
> Between UCSI 1.2 and UCSI 2.0, the size of the MESSAGE_IN region was
> increased from 16 to 256. In order to avoid overflowing reads for older
> systems, add a mechanism to use the read UCSI version to truncate read
> sizes on UCSI v1.2.
...
> + if (ucsi->version <= UCSI_VERSION_1_2)
> + buf_size = min_t(size_t, 16, buf_size);
Please, avoid using min_t(). Here the clamp() can be used.
Shouldn't magic number be defined?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-02-09 14:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 6:02 [PATCH v4 0/3] usb: typec: ucsi: Adding support for UCSI 3.0 Abhishek Pandit-Subedi
2024-02-09 6:02 ` [PATCH v4 1/3] usb: typec: ucsi: Limit read size on v1.2 Abhishek Pandit-Subedi
2024-02-09 14:28 ` Andy Shevchenko [this message]
2024-02-09 18:01 ` Abhishek Pandit-Subedi
2024-02-09 19:39 ` Andy Shevchenko
2024-02-09 22:34 ` Abhishek Pandit-Subedi
2024-02-09 6:02 ` [PATCH v4 2/3] usb: typec: ucsi: Update connector cap and status Abhishek Pandit-Subedi
2024-02-09 6:02 ` [PATCH v4 3/3] usb: typec: ucsi: Get PD revision for partner Abhishek Pandit-Subedi
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=ZcY2kVlUn7SJ5pW8@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=abhishekpandit@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=fabrice.gasnier@foss.st.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=jthies@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=pmalani@chromium.org \
--cc=rajaram.regupathy@intel.com \
--cc=saranya.gopal@intel.com \
/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