Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859AbeABLAl (ORCPT + 1 other); Tue, 2 Jan 2018 06:00:41 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:55181 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751390AbeABLAj (ORCPT ); Tue, 2 Jan 2018 06:00:39 -0500 From: Arnd Bergmann To: Andrew Morton , Chris Zankel , Max Filippov Cc: linux-arch@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH] xtensa: shut up gcc-8 warnings Date: Tue, 2 Jan 2018 12:00:22 +0100 Message-Id: <20180102110035.1806925-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:aRQl2T18NZJbi/NUHzGPMmpaKZG6aM+A6sVytkL/HCovm1xMpnN RBvvk0Vabt6jietuCo5x/7d4xhIm9v92jaoMOgasCLTxPrCDPhOur8/Fl2m2/4yx9iQkLkc DuAO4SCG+eAr1csG88DfbnGUD3TIErl+gpw7cpqTQYx7y57H3dpjK5LVIgCGKYx6TNat5Te 0FXuOOPW3mMc7NFIumcAg== X-UI-Out-Filterresults: notjunk:1;V01:K0:GPV3RCnaMAg=:hJoMXxBCmXDk6Yxlz8GIcL OyTRug1sFP/bgFMoyiyZ26UHVWEvr7qPG+3mKjHiEA11R0DgAe/BHWhBqgB9GGmQdz+1wKWkG hu3yawzx5Vs1eZuRsCS9DDQQzGpcriQaGuRseFmoEfddnBKKoa1TugeDDMvRJQkdEwrlzCmHx 9UJUQ+fUdrYYbh5cLe3WHAsYCGlAWxNZWZwZS/itjj9T8ilCvGkpzwVAYEfkmU6qDk5FanSNg LtgUb2uUFc0VHIUzMZs5oHx9mPNT7xFY9ZL6BielBkUOsit8VdF8Bph1lafSwhEFd4SOG/Bak 8u2efT/QNaD4a9nrhPjDnQlwQidL1o5POWDfzarHf9T3CN0la0SmcLHbG1dH/xLP8vI9EWegS /R4BXxEFXG/113EJKK+rpyhIBQynX/xe8gMf13qy7oFtsvk2LxXnAhq+XdwukPgy3wt27XcrI cDw4yI+l3w2/0ssBFV3qWQhBIhRhfcvfgNNaCN7IfkXt+Qabt2HkHcI9XIB10P1sBW3FZL77K d2K1t6P33mFJeW4b25Oi16OYyrb5o4FGgDc88ySbepz/RaXQU3R3FL68U8SOa7HP/5N/aWhP3 geuPUeAyqOfMdcPvHJgFHal0i5bm1VsGeH86tnyCpv36Vx6c+aAy2yQg0JJbSPjlTP/lvWX8L Uhd+iDGa8zHjt1rSpk4mStbzgWRTcdePODPOQCkQFEv5QcQqJsHm4Jzh3XC+tD/tn2doAWP67 u3Jm3j22rCeR1zmZeH0RhiW0IaNTLG+eC9e10g== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Many uses of strncpy() on xtensa causes a warning like arch/xtensa/include/asm/string.h:56:42: warning: array subscript is above array bounds [-Warray-bounds] : "0" (__dest), "1" (__src), "r" (__src+__n) This avoids the warning by turning the pointer arithmetic into an integer operation that does not get checked the same way. Signed-off-by: Arnd Bergmann --- arch/xtensa/include/asm/string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/include/asm/string.h b/arch/xtensa/include/asm/string.h index 586bad9fe187..89b51a0c752f 100644 --- a/arch/xtensa/include/asm/string.h +++ b/arch/xtensa/include/asm/string.h @@ -53,7 +53,7 @@ static inline char *strncpy(char *__dest, const char *__src, size_t __n) "bne %1, %5, 1b\n" "2:" : "=r" (__dest), "=r" (__src), "=&r" (__dummy) - : "0" (__dest), "1" (__src), "r" (__src+__n) + : "0" (__dest), "1" (__src), "r" ((uintptr_t)__src+__n) : "memory"); return __xdest; @@ -101,7 +101,7 @@ static inline int strncmp(const char *__cs, const char *__ct, size_t __n) "2:\n\t" "sub %2, %2, %3" : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&r" (__dummy) - : "0" (__cs), "1" (__ct), "r" (__cs+__n)); + : "0" (__cs), "1" (__ct), "r" ((uintptr_t)__cs+__n)); return __res; } -- 2.9.0