From: Dmytro Linkin <dlinkin@nvidia.com>
To: Colin King <colin.king@canonical.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Yuval Avnery <yuvalav@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] netdevsim: Fix unsigned being compared to less than zero
Date: Fri, 4 Jun 2021 10:10:27 +0300 [thread overview]
Message-ID: <111afba0-1f6f-12b5-4d1c-733172b1b1ea@nvidia.com> (raw)
In-Reply-To: <20210603215657.154776-1-colin.king@canonical.com>
On 6/4/21 12:56 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The comparison of len < 0 is always false because len is a size_t. Fix
> this by making len a ssize_t instead.
>
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: d395381909a3 ("netdevsim: Add max_vfs to bus_dev")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/net/netdevsim/bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/netdevsim/bus.c b/drivers/net/netdevsim/bus.c
> index b56003dfe3cc..ccec29970d5b 100644
> --- a/drivers/net/netdevsim/bus.c
> +++ b/drivers/net/netdevsim/bus.c
> @@ -111,7 +111,7 @@ ssize_t nsim_bus_dev_max_vfs_read(struct file *file,
> {
> struct nsim_bus_dev *nsim_bus_dev = file->private_data;
> char buf[11];
> - size_t len;
> + ssize_t len;
>
> len = snprintf(buf, sizeof(buf), "%u\n", nsim_bus_dev->max_vfs);
> if (len < 0)
>
Thanks.
next prev parent reply other threads:[~2021-06-04 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-03 21:56 [PATCH][next] netdevsim: Fix unsigned being compared to less than zero Colin King
2021-06-03 22:40 ` patchwork-bot+netdevbpf
2021-06-04 7:10 ` Dmytro Linkin [this message]
2021-06-04 11:17 ` Dan Carpenter
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=111afba0-1f6f-12b5-4d1c-733172b1b1ea@nvidia.com \
--to=dlinkin@nvidia.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=jiri@nvidia.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yuvalav@nvidia.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;
as well as URLs for NNTP newsgroup(s).