From: Kalle Valo <kvalo@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Solomon Peachy <pizza@shaftnet.org>,
linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] cw1200: Fix a signedness bug in cw1200_load_firmware()
Date: Wed, 25 Sep 2019 14:06:45 +0300 [thread overview]
Message-ID: <87o8z8zlbu.fsf@codeaurora.org> (raw)
In-Reply-To: <20190925105943.GJ3264@mwanda> (Dan Carpenter's message of "Wed, 25 Sep 2019 13:59:43 +0300")
Dan Carpenter <dan.carpenter@oracle.com> writes:
> The "priv->hw_type" is an enum and in this context GCC will treat it
> as an unsigned int so the error handling will never trigger.
>
> Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/wireless/st/cw1200/fwio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/st/cw1200/fwio.c b/drivers/net/wireless/st/cw1200/fwio.c
> index 6574e78e05ea..da767c33dfbb 100644
> --- a/drivers/net/wireless/st/cw1200/fwio.c
> +++ b/drivers/net/wireless/st/cw1200/fwio.c
> @@ -321,7 +321,7 @@ int cw1200_load_firmware(struct cw1200_common *priv)
> }
>
> priv->hw_type = cw1200_get_hw_type(val32, &major_revision);
> - if (priv->hw_type < 0) {
> + if ((int)priv->hw_type < 0) {
> pr_err("Can't deduce hardware type.\n");
> ret = -ENOTSUPP;
> goto out;
Isn't there any cleaner way to fix this? Like having 'int ret' variable
and assign to priv->hw_type after the error handling?
--
Kalle Valo
next prev parent reply other threads:[~2019-09-25 11:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 10:59 [PATCH] cw1200: Fix a signedness bug in cw1200_load_firmware() Dan Carpenter
2019-09-25 11:06 ` Kalle Valo [this message]
2019-10-01 11:45 ` [PATCH v2] " Dan Carpenter
2019-10-01 12:02 ` Kalle Valo
2019-10-02 4:35 ` Kalle Valo
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=87o8z8zlbu.fsf@codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=pizza@shaftnet.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;
as well as URLs for NNTP newsgroup(s).