From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750957AbcFDNQ0 (ORCPT ); Sat, 4 Jun 2016 09:16:26 -0400 Received: from science.sciencehorizons.net ([71.41.210.147]:62311 "HELO ns.sciencehorizons.net" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with SMTP id S1750850AbcFDNQY (ORCPT ); Sat, 4 Jun 2016 09:16:24 -0400 Date: 4 Jun 2016 09:16:22 -0400 Message-ID: <20160604131622.28377.qmail@ns.sciencehorizons.net> From: "George Spelvin" To: andriy.shevchenko@linux.intel.com Subject: [PATCH v2 3/2] lib/uuid.c: Silence an unchecked return value warning Cc: bjorn@mork.no, linux-kernel@vger.kernel.org, linux@sciencehorizons.net, matt@codeblueprint.co.uk, rv@rasmusvillemoes.dk In-Reply-To: <20160604051305.3521.qmail@ns.sciencehorizons.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; return 0; } -- 2.8.1