From: Greg KH <gregkh@linuxfoundation.org>
To: Amit Sunil Dhamne <amitsd@google.com>
Cc: heikki.krogerus@linux.intel.com, badhri@google.com,
kyletso@google.com, rdbabiera@google.com,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v1] usb: typec: Fix arg check for usb_power_delivery_unregister_capabilities
Date: Thu, 19 Sep 2024 10:11:37 +0200 [thread overview]
Message-ID: <2024091956-premiere-given-c496@gregkh> (raw)
In-Reply-To: <20240919075815.332017-1-amitsd@google.com>
On Thu, Sep 19, 2024 at 12:58:12AM -0700, Amit Sunil Dhamne wrote:
> usb_power_delivery_register_capabilities() returns ERR_PTR in case of
> failure. usb_power_delivery_unregister_capabilities() we only check
> argument ("cap") for NULL. A more robust check would be checking for
> ERR_PTR as well.
>
> Cc: stable@vger.kernel.org
> Fixes: 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C")
> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
> Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
> ---
> drivers/usb/typec/pd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
> index d78c04a421bc..761fe4dddf1b 100644
> --- a/drivers/usb/typec/pd.c
> +++ b/drivers/usb/typec/pd.c
> @@ -519,7 +519,7 @@ EXPORT_SYMBOL_GPL(usb_power_delivery_register_capabilities);
> */
> void usb_power_delivery_unregister_capabilities(struct usb_power_delivery_capabilities *cap)
> {
> - if (!cap)
> + if (IS_ERR_OR_NULL(cap))
This feels like there's a wrong caller, why would this be called with an
error value in the first place? Why not fix that? And why would this
be called with NULL as well in the first place?
thanks,
greg k-h
next prev parent reply other threads:[~2024-09-19 9:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-19 7:58 [PATCH v1] usb: typec: Fix arg check for usb_power_delivery_unregister_capabilities Amit Sunil Dhamne
2024-09-19 8:11 ` Greg KH [this message]
2024-09-19 10:03 ` Dmitry Baryshkov
2024-09-19 22:50 ` Amit Sunil Dhamne
2024-09-19 8:51 ` Dmitry Baryshkov
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=2024091956-premiere-given-c496@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=amitsd@google.com \
--cc=badhri@google.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=kyletso@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rdbabiera@google.com \
--cc=stable@vger.kernel.org \
/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