From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: George Spelvin <linux@sciencehorizons.net>
Cc: bjorn@mork.no, linux-kernel@vger.kernel.org,
matt@codeblueprint.co.uk, rv@rasmusvillemoes.dk
Subject: Re: [PATCH v2 3/2] lib/uuid.c: Silence an unchecked return value warning
Date: Sun, 05 Jun 2016 17:21:04 +0300 [thread overview]
Message-ID: <1465136464.1767.57.camel@linux.intel.com> (raw)
In-Reply-To: <20160604131622.28377.qmail@ns.sciencehorizons.net>
On Sat, 2016-06-04 at 09:16 -0400, George Spelvin wrote:
> Andy Shevchenko pointed out that __uuid_to_bin doesn't need to check
> the return value from hex2bin(), because the preceding uuid_is_valid()
> check already took care of that.
>
> But hex2bin() is declared __must_check, so checking anyway is the
> simplest way to silence the warning.
>
> This cancels a small fraction of the the space savings, but not all:
>
> vs. previous patch vs. before patch series
> Before After Delta Percent Orig. Delta
> Percent
> x86-32 90 96 +6 6.7% 122 -
> 26 -21.3%
> x86-64 90 96 +6 6.7% 127 -31
> -24.4%
> arm 92 104 +12 13.0% 116 -12
> -10.3%
> thumb 50 62 +12 24.0% 100 -38
> -38.0%
> arm64 116 124 +8 6.9% 148 -24
> -16.2%
>
> Signed-off-by: George Spelvin <linux@sciencehorizons.net>
> ---
> lib/uuid.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/uuid.c b/lib/uuid.c
> index 93945915..1a6dbbd2 100644
> --- a/lib/uuid.c
> +++ b/lib/uuid.c
> @@ -104,7 +104,8 @@ static int __uuid_to_bin(const char uuid[36], __u8
> b[16], const u8 pos[16])
> return -EINVAL;
>
> for (i = 0; i < 16; i++)
> - hex2bin(b + i, uuid + pos[i], 1);
> + if (hex2bin(b + i, uuid + pos[i], 1) < 0)
> + return -EINVAL;
Which I against of. Please, use normal hex_to_bin() calls here.
Compiler will inline it anyway, but at least will not do second check
for nothing.
>
> return 0;
> }
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2016-06-05 14:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1464952090.1767.34.camel@linux.intel.com>
2016-06-04 5:13 ` [PATCH v2 0/2] Clean up and shrink uuid input & output George Spelvin
2016-06-04 5:14 ` [PATCH v2 1/2] lib/vsprintf.c: Simplify uuid_string() George Spelvin
2016-06-05 14:22 ` Andy Shevchenko
2016-06-05 19:57 ` George Spelvin
2016-06-04 5:14 ` [PATCH v2 2/2] lib/uuid.c: eliminate uuid_[bl]e_index arrays George Spelvin
2016-06-04 5:42 ` kbuild test robot
2016-06-04 16:29 ` Joe Perches
2016-06-04 21:57 ` George Spelvin
2016-06-05 14:19 ` Andy Shevchenko
2016-06-05 14:19 ` Andy Shevchenko
2016-06-05 15:34 ` Joe Perches
2016-06-05 15:34 ` Joe Perches
2016-06-05 16:15 ` Andy Shevchenko
2016-06-05 16:15 ` Andy Shevchenko
2016-06-04 13:16 ` [PATCH v2 3/2] lib/uuid.c: Silence an unchecked return value warning George Spelvin
2016-06-05 14:21 ` Andy Shevchenko [this message]
2016-06-05 19:25 ` George Spelvin
2016-06-06 8:24 ` Andy Shevchenko
2016-06-07 16:43 ` George Spelvin
2016-06-07 17:13 ` Joe Perches
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=1465136464.1767.57.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bjorn@mork.no \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@sciencehorizons.net \
--cc=matt@codeblueprint.co.uk \
--cc=rv@rasmusvillemoes.dk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.