From: Marc Kleine-Budde <mkl@pengutronix.de>
To: yegorslists@googlemail.com
Cc: linux-can@vger.kernel.org
Subject: Re: [PATCH] candump: resolve signedness warnings
Date: Thu, 19 Apr 2012 10:54:25 +0200 [thread overview]
Message-ID: <4F8FD2C1.8010903@pengutronix.de> (raw)
In-Reply-To: <1334821446-2925-1-git-send-email-yegorslists@googlemail.com>
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
On 04/19/2012 09:44 AM, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
nbytes has been tested before if it's < 0, so it's safe to cast it to an
unsigned value.
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Oliver do you want to take the patch?
Marc
> ---
> candump.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/candump.c b/candump.c
> index 5ba9431..ac51192 100644
> --- a/candump.c
> +++ b/candump.c
> @@ -611,7 +611,7 @@ int main(int argc, char **argv)
> return 1;
> }
>
> - if (nbytes < sizeof(struct can_frame)) {
> + if ((size_t)nbytes < sizeof(struct can_frame)) {
> fprintf(stderr, "read: incomplete CAN frame\n");
> return 1;
> }
> @@ -627,7 +627,7 @@ int main(int argc, char **argv)
> if (nbytes < 0) {
> perror("bridge write");
> return 1;
> - } else if (nbytes < sizeof(struct can_frame)) {
> + } else if ((size_t)nbytes < sizeof(struct can_frame)) {
> fprintf(stderr,"bridge write: incomplete CAN frame\n");
> return 1;
> }
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-04-19 8:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 7:44 [PATCH] candump: resolve signedness warnings yegorslists
2012-04-19 8:54 ` Marc Kleine-Budde [this message]
2012-04-19 15:46 ` Oliver Hartkopp
2012-04-19 15:57 ` Marc Kleine-Budde
2012-04-19 16:01 ` Wolfram Sang
2012-04-19 16:03 ` Marc Kleine-Budde
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=4F8FD2C1.8010903@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=yegorslists@googlemail.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).