From patchwork Fri Mar 2 19:49:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Malaterre X-Patchwork-Id: 880834 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ztKjc550yz9s4c for ; Sat, 3 Mar 2018 06:53:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hc41u6FM"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3ztKjc2QRjzF191 for ; Sat, 3 Mar 2018 06:53:24 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hc41u6FM"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=mathieu.malaterre@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hc41u6FM"; dkim-atps=neutral Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3ztKdc1WhNzF1t9 for ; Sat, 3 Mar 2018 06:49:55 +1100 (AEDT) Received: by mail-wm0-x242.google.com with SMTP id x7so5068281wmc.0 for ; Fri, 02 Mar 2018 11:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wQcipb0YMa9zXmssK4hvJ8dln1RCkdqSEjYmI87PYXE=; b=Hc41u6FM1ZPUlZonMrLPo/s41EMLqqpZcrlyzt80+O4nu8wdZ/RZA6uzGPecoJRevR wm2Y7YjiKb4tavB8Epkcu5pja5aHNb9rAebQCrgyu4CZSXt8zVvdJfAsq/tP1yd9/gKX nFWNLJCdIlom6ewKbMvHLS9p0dntEQ/kQLDcTrMJvIYh08Y+nKu1m1yVCCwNkWtUxpyc hK03f1JIoURZYbq4/vMAhozgRfvb2RZEPw/BcWTTkDEr3sL22TqdOklcyPugurYXnNZb zs52eYplkDC/l6pNPgkAvss3DvWKkSrpyW4bS5yParjeW1licvv9bZbH87dITFK0d9vM 6EHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wQcipb0YMa9zXmssK4hvJ8dln1RCkdqSEjYmI87PYXE=; b=uFKUpew9MptsoX+gDAYK7sfcETU5gCvlgGbz2wLAXAl4qdsczLP2n/nRU5J22tpkVn sNP+Q+O45UKYdbsNG998+gX0lISCnYdVt040xmpg1jPgo4vEUiHjTzD7VVWOSfbuAx8m e/k6M3SkShdEDU8RWUJa6dmenib8yTXH4NgYUEsjQz89qsW6lfBoX/aFyexZ80swM/sT gNtkcdtbLKfLCrCRRqxEMqGqMsu2H2Aw1T/VbkBwQYQv4nyzUPh/HmE5Jyz9vNJvIq1/ TUhbPhkwV8AFkn4/yMWNOxadKUZLomE6z8DWmXVSjykFfSEBe/bB7RKjgezDmLy3U8al Nj0A== X-Gm-Message-State: AElRT7EUghlymJ6xqOiySVXNzb+fZUvf45ucOjspXO/rZYuiCkg9eE5+ nLytJnCLoiWE7+HvsQtyogQ= X-Google-Smtp-Source: AG47ELvpDuRxoM25LiFSFb+OrS/Q5PXCTIJmTXu2FkO+6hF040R+XeKeX/2LUwbnRrv8c6MbmqNtbg== X-Received: by 10.28.160.26 with SMTP id j26mr2260881wme.76.1520020187648; Fri, 02 Mar 2018 11:49:47 -0800 (PST) Received: from macbookpro.malat.net (bru31-1-78-225-226-121.fbx.proxad.net. [78.225.226.121]) by smtp.gmail.com with ESMTPSA id 188sm1645828wmx.12.2018.03.02.11.49.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Mar 2018 11:49:45 -0800 (PST) Received: by macbookpro.malat.net (Postfix, from userid 1000) id 7440B10C0480; Fri, 2 Mar 2018 20:49:44 +0100 (CET) From: Mathieu Malaterre To: Michael Ellerman Subject: [PATCH v2 01/21] powerpc: Remove warning on array size when empty Date: Fri, 2 Mar 2018 20:49:18 +0100 Message-Id: <20180302194918.4358-1-malat@debian.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180225172236.29650-2-malat@debian.org> References: <20180225172236.29650-2-malat@debian.org> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathieu Malaterre , linux-kernel@vger.kernel.org, Andy Shevchenko , Paul Mackerras , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When neither CONFIG_ALTIVEC, nor CONFIG_VSX or CONFIG_PPC64 is defined, the array feature_properties is defined as an empty array, which in turn triggers the following warning (treated as error on W=1): CC arch/powerpc/kernel/prom.o arch/powerpc/kernel/prom.c: In function ‘check_cpu_feature_properties’: arch/powerpc/kernel/prom.c:298:16: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) { ^ cc1: all warnings being treated as errors Suggested-by: Michael Ellerman Signed-off-by: Mathieu Malaterre --- arch/powerpc/kernel/prom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 4dffef947b8a..330c65f04820 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -291,11 +291,11 @@ static inline void identical_pvr_fixup(unsigned long node) static void __init check_cpu_feature_properties(unsigned long node) { - unsigned long i; + int i; struct feature_property *fp = feature_properties; const __be32 *prop; - for (i = 0; i < ARRAY_SIZE(feature_properties); ++i, ++fp) { + for (i = 0; i < (int)ARRAY_SIZE(feature_properties); ++i, ++fp) { prop = of_get_flat_dt_prop(node, fp->name, NULL); if (prop && be32_to_cpup(prop) >= fp->min_value) { cur_cpu_spec->cpu_features |= fp->cpu_feature; From patchwork Fri Mar 2 19:50:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Malaterre X-Patchwork-Id: 880837 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ztKq71cp5z9s4c for ; Sat, 3 Mar 2018 06:58:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ljb24LK1"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3ztKq66b5kzF1s6 for ; Sat, 3 Mar 2018 06:58:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ljb24LK1"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2a00:1450:400c:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=mathieu.malaterre@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ljb24LK1"; dkim-atps=neutral Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3ztKgN74mVzF1tV for ; Sat, 3 Mar 2018 06:51:28 +1100 (AEDT) Received: by mail-wr0-x244.google.com with SMTP id w77so11245043wrc.6 for ; Fri, 02 Mar 2018 11:51:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JXMPJ74crxWeho504tdAwnPQKbXDFKHz34p7ljdPDcg=; b=ljb24LK1P0VkFc6ZudFSSIEc0nEjFj9m3YkPpwXDVLgy92KKQoWSdcfdwCK1G0qDSP 42rlRF/Xsr0bAaj4dKKtKUbJXFOA1P07VF+eNvqw3nga101BQNdEPy1pV8I/0aRyV1FM hgiS1Q2mgHodTJhkRUOBqdcBzHqkty/lF6yj/LjbcJqR+5lZp77TfPyIrHo3YYASNN71 dVLC+qOGvUZQa7IRDZ/UllVLniySbHBwAW3yy30Pku5AHeK6gV5aORJK7t49EmZE8pwP MaT3WhTgKPfDSfCBYd5nXSzrhvwzQFOgybC+mcOiAziFbH7fvV0gA6KjNerBzb83hSeH IGVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=JXMPJ74crxWeho504tdAwnPQKbXDFKHz34p7ljdPDcg=; b=c7nkog96smCYK+DQa6JoYcoQaTR+ZWZvgOEF2qknt2BW2NmIaoaZ/9HAIsKP6gEeqh KibR/WERw5U+CH9hrgY6EJ4p3AW79L30E/eGLjlDGJTqo5LUVLNeePz0rzan1CvMcRtv ivGt4LmaGJc3QGX9S9NTKbT0EESo5TL8kwN1WzlqNtZD8q1Dr0bDUgrSt+3aXruB66KI qTAuGP50GGc0RyA/SKXCKNdfeFdvHpB5NvMWMKZQZuS1o9/NwdMl2sZAbyJ4bYWyvuIu TWN6DRdrUPi4sXq9wHK8LEO66TBM/XUeXe0iIq9GHMQGQ6bTNmdwTS5W2y+iwzeqU1sX x82A== X-Gm-Message-State: APf1xPDcol/O36bWoi5RpbS7n3rGIclIudbG3ogG78ifrunPNt5534aD 4U/y2hwG43+OK5kROSHtOZY= X-Google-Smtp-Source: AG47ELsBJCyK4JLUMCIqflSGS52AV53TzGJwBmaKhwXbgdtpMmG0OMHjEnJLwPbSzTTpGR5/Qvlosw== X-Received: by 10.223.179.82 with SMTP id k18mr5989423wrd.173.1520020285801; Fri, 02 Mar 2018 11:51:25 -0800 (PST) Received: from macbookpro.malat.net (bru31-1-78-225-226-121.fbx.proxad.net. [78.225.226.121]) by smtp.gmail.com with ESMTPSA id k18sm2135275wmd.4.2018.03.02.11.51.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Mar 2018 11:51:25 -0800 (PST) Received: by macbookpro.malat.net (Postfix, from userid 1000) id 46F4110C0480; Fri, 2 Mar 2018 20:51:24 +0100 (CET) From: Mathieu Malaterre To: Michael Ellerman Subject: [PATCH v2 06/21] powerpc: Avoid comparison of unsigned long >= 0 in __access_ok Date: Fri, 2 Mar 2018 20:50:51 +0100 Message-Id: <20180302195051.4472-1-malat@debian.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180225172236.29650-7-malat@debian.org> References: <20180225172236.29650-7-malat@debian.org> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathieu Malaterre , linux-kernel@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Rewrite function-like macro into regular static inline function to avoid a warning during macro expansion. Fix warning (treated as error in W=1): CC arch/powerpc/kernel/signal_32.o In file included from ./include/linux/uaccess.h:14:0, from ./include/asm-generic/termios-base.h:8, from ./arch/powerpc/include/asm/termios.h:20, from ./include/uapi/linux/termios.h:6, from ./include/linux/tty.h:7, from arch/powerpc/kernel/signal_32.c:36: ./include/asm-generic/termios-base.h: In function ‘user_termio_to_kernel_termios’: ./arch/powerpc/include/asm/uaccess.h:52:35: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr))))) ^ ./arch/powerpc/include/asm/uaccess.h:58:3: note: in expansion of macro ‘__access_ok’ __access_ok((__force unsigned long)(addr), (size), get_fs())) ^~~~~~~~~~~ ./arch/powerpc/include/asm/uaccess.h:262:6: note: in expansion of macro ‘access_ok’ if (access_ok(VERIFY_READ, __gu_addr, (size))) \ ^~~~~~~~~ ./arch/powerpc/include/asm/uaccess.h:80:2: note: in expansion of macro ‘__get_user_check’ __get_user_check((x), (ptr), sizeof(*(ptr))) ^~~~~~~~~~~~~~~~ ./include/asm-generic/termios-base.h:36:6: note: in expansion of macro ‘get_user’ if (get_user(termios->c_line, &termio->c_line) < 0) ^~~~~~~~ [...] cc1: all warnings being treated as errors Suggested-by: Segher Boessenkool Signed-off-by: Mathieu Malaterre Reviewed-by: Christophe Leroy --- arch/powerpc/include/asm/uaccess.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 51bfeb8777f0..a62ee663b2c8 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -47,9 +47,13 @@ #else -#define __access_ok(addr, size, segment) \ - (((addr) <= (segment).seg) && \ - (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr))))) +static inline int __access_ok(unsigned long addr, unsigned long size, + mm_segment_t seg) +{ + if (addr > seg.seg) + return 0; + return (size == 0 || size - 1 <= seg.seg - addr); +} #endif