Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp774756imu; Tue, 11 Dec 2018 07:23:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/XTpAi9vB1VkAhOzl5jyUPehk0r1stdTarYO6OqcIenjvSpteFkJzTxdHP1ADp4lnvUoavZ X-Received: by 2002:a62:13c3:: with SMTP id 64mr16653676pft.93.1544541810063; Tue, 11 Dec 2018 07:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544541810; cv=none; d=google.com; s=arc-20160816; b=fmm5MiVDJLwpN1jjFSzUROEallHbGYXHKUZ7mW7rsPvZy1YeD9R3LDLOhx6LimsjZS 1r1zokmrtN/cRWMypFsmdwopL9aQRcuslYHs7nFgCa0qsvJ7inlpxer3Npq23pcpzNaG 2rizQOtwy5SDrnoGoxzpXUgAykqghhq8uI5Qz9LekLWblZYxFGe3tuf5AJ0OLp88subX ULu09xk8LLvitBd2ReBeiIRTaoTyB+6ZHD1E4mXFEzIYnjaDeNS9OVaIBrlR9zODD3jY c/IS9rmYSykONtYoF90yQu8dsTM4sHSd1QIebH67ehkh4/Sv+4fc4l78qWlMHDuXXqUS hQdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=+JGnPfTgeGADfKmZEYKGYbeaJbvmJvlHwpZn80TThrw=; b=piJgIkDvwj2U01dMMpAGBYO1U5uYUkp9zJURURtNOHRcF3h6n6jXvmC3DhsNGjlvWs Rrg1lxM6vUyRUr9mzxFaGCuUP0UxPsujyfRd/7eSNeG3RIxVCi+q7J9EuqFbjicowI26 Duc4O4GM6uR9TuRq99uS+nYlAhL2GYXF0mFttQXScarTe6kICu6BpSh9MmQpLJFjJ0q1 D/WyKntOceM6sX4zaBaqKNJC7ExNxv3y+wxsW1s8L+0k1n3h0zvX88jssqtkQ9JB49oX 8Jhkqr95FnkXBCxCV6LClt53IzDmUWcTtDMVMH0JkCHYs12s8rIL1fs9P4xdZNDQFzPM sfxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si12192023pgl.457.2018.12.11.07.23.13; Tue, 11 Dec 2018 07:23:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbeLKPVa (ORCPT + 99 others); Tue, 11 Dec 2018 10:21:30 -0500 Received: from imap1.codethink.co.uk ([176.9.8.82]:57997 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbeLKPV3 (ORCPT ); Tue, 11 Dec 2018 10:21:29 -0500 Received: from office.codethink.co.uk ([148.252.241.226] helo=devhw0) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1gWjqV-0002GB-U2; Tue, 11 Dec 2018 15:21:16 +0000 Received: from tpreston by devhw0 with local (Exim 4.89) (envelope-from ) id 1gWjqV-0002EC-Go; Tue, 11 Dec 2018 15:21:15 +0000 From: Thomas Preston To: akpm@linux-foundation.org, pmladek@suse.com, andriy.shevchenko@linux.intel.com, rostedt@goodmis.org, geert+renesas@glider.be, corbet@lwn.net, me@tobin.cc, sergey.senozhatsky@gmail.com, linux-kernel@vger.kernel.org Cc: Thomas Preston Subject: [PATCH 1/2] vsprintf: Specify type for union val members Date: Tue, 11 Dec 2018 15:21:12 +0000 Message-Id: <20181211152113.8523-2-thomas.preston@codethink.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181211152113.8523-1-thomas.preston@codethink.co.uk> References: <20181211152113.8523-1-thomas.preston@codethink.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vsscanf function uses implicit type casting to populate the long long integers in union val from the obsolete functions simple_strtol() and simple_strtoll(). However the new functions kstrtol() and kstrtoll() expect a pointer to the correct type, so we must be explicit about which type we are using. Signed-off-by: Thomas Preston --- lib/vsprintf.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 37a54a6dd594..bbf2ac734711 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2914,8 +2914,8 @@ int vsscanf(const char *buf, const char *fmt, va_list args) u8 qualifier; unsigned int base; union { - long long s; - unsigned long long u; + long long sll; + unsigned long long ull; } val; s16 field_width; bool is_sign; @@ -3120,11 +3120,11 @@ int vsscanf(const char *buf, const char *fmt, va_list args) break; if (is_sign) - val.s = qualifier != 'L' ? + val.sll = qualifier != 'L' ? simple_strtol(str, &next, base) : simple_strtoll(str, &next, base); else - val.u = qualifier != 'L' ? + val.ull = qualifier != 'L' ? simple_strtoul(str, &next, base) : simple_strtoull(str, &next, base); @@ -3133,9 +3133,9 @@ int vsscanf(const char *buf, const char *fmt, va_list args) _parse_integer_fixup_radix(str, &base); while (next - str > field_width) { if (is_sign) - val.s = div_s64(val.s, base); + val.sll = div_s64(val.sll, base); else - val.u = div_u64(val.u, base); + val.ull = div_u64(val.ull, base); --next; } } @@ -3143,36 +3143,36 @@ int vsscanf(const char *buf, const char *fmt, va_list args) switch (qualifier) { case 'H': /* that's 'hh' in format */ if (is_sign) - *va_arg(args, signed char *) = val.s; + *va_arg(args, signed char *) = val.sll; else - *va_arg(args, unsigned char *) = val.u; + *va_arg(args, unsigned char *) = val.ull; break; case 'h': if (is_sign) - *va_arg(args, short *) = val.s; + *va_arg(args, short *) = val.sll; else - *va_arg(args, unsigned short *) = val.u; + *va_arg(args, unsigned short *) = val.ull; break; case 'l': if (is_sign) - *va_arg(args, long *) = val.s; + *va_arg(args, long *) = val.sll; else - *va_arg(args, unsigned long *) = val.u; + *va_arg(args, unsigned long *) = val.ull; break; case 'L': if (is_sign) - *va_arg(args, long long *) = val.s; + *va_arg(args, long long *) = val.sll; else - *va_arg(args, unsigned long long *) = val.u; + *va_arg(args, unsigned long long *) = val.ull; break; case 'z': - *va_arg(args, size_t *) = val.u; + *va_arg(args, size_t *) = val.ull; break; default: if (is_sign) - *va_arg(args, int *) = val.s; + *va_arg(args, int *) = val.sll; else - *va_arg(args, unsigned int *) = val.u; + *va_arg(args, unsigned int *) = val.ull; break; } num++; -- 2.11.0