netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: min.li.xe@renesas.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 net] ptp: clockmatrix: bug fix for idtcm_strverscmp
Date: Tue, 24 Nov 2020 15:59:08 -0800	[thread overview]
Message-ID: <20201124235908.GA28743@hoboy.vegasvil.org> (raw)
In-Reply-To: <1606233686-22785-1-git-send-email-min.li.xe@renesas.com>

On Tue, Nov 24, 2020 at 11:01:26AM -0500, min.li.xe@renesas.com wrote:
> From: Min Li <min.li.xe@renesas.com>
> 
> Feed kstrtou8 with NULL terminated string.
> 
> Changes since v1:
> -Use sscanf to get rid of adhoc string parse.

This is much nicer.  Small issue remains...

> +	u8 ver1[3], ver2[3];
> +	int i;
> +
> +	if (sscanf(version1, "%hhu.%hhu.%hhu",
> +		   &ver1[0], &ver1[1], &ver1[2]) < 0)
> +		return -1;

The sscanf function returns the number of scanned items, and so you
should check that it returns 3 (three).

> +	if (sscanf(version2, "%hhu.%hhu.%hhu",
> +		   &ver2[0], &ver2[1], &ver2[2]) < 0)
> +		return -1;

Same here.

Thanks,
Richard

  reply	other threads:[~2020-11-24 23:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 16:01 [PATCH v2 net] ptp: clockmatrix: bug fix for idtcm_strverscmp min.li.xe
2020-11-24 23:59 ` Richard Cochran [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-11-23 20:20 min.li.xe
2020-11-24  1:23 ` Richard Cochran
2020-11-19  3:50 min.li.xe
2020-11-21 21:40 ` Jakub Kicinski

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=20201124235908.GA28743@hoboy.vegasvil.org \
    --to=richardcochran@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=min.li.xe@renesas.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).