From patchwork Thu Aug 3 07:28:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 709819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AADABC001E0 for ; Thu, 3 Aug 2023 07:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232226AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbjHCH2w (ORCPT ); Thu, 3 Aug 2023 03:28:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70471187; Thu, 3 Aug 2023 00:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047728; bh=Dq8jbZTyhLjjfrXzMVP5XMUcw7zpYJiDlah00ed3ZfA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KHa0PEaHkP20XujShvLhET41cKqgvBcTEeUXjNBa8W9xU864D9jwX8k8zpM4lloLJ r5/aPAG5R6IpbYdNPuTcxm26O04yEo6+fX2ELLcgqxtgCRhBb3/TUafcnJ0JKQHI0C Wlwo6qz4SyJKj5d6xwvbM6BDPSz/UivF/GShLT6U= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:47 +0200 Subject: [PATCH v3 03/14] tools/nolibc: setvbuf: avoid unused parameter warnings MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-3-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=810; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Dq8jbZTyhLjjfrXzMVP5XMUcw7zpYJiDlah00ed3ZfA=; b=y/x5UwahV+LCwccwghbOr9hgOU+M1lJT3l4QTOWofdAIStedWSwlXVZEe9082mVNHVjngX1QT m1550V64flcD7+j7YdZAfdVtF5nsfMp2kAWLHEJ6HoA5x+0i2Nkhfyy X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This warning will be enabled later so avoid triggering it. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdio.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h index a3778aff4fa9..cae402c11e57 100644 --- a/tools/include/nolibc/stdio.h +++ b/tools/include/nolibc/stdio.h @@ -356,7 +356,10 @@ void perror(const char *msg) } static __attribute__((unused)) -int setvbuf(FILE *stream, char *buf, int mode, size_t size) +int setvbuf(FILE *stream __attribute__((unused)), + char *buf __attribute__((unused)), + int mode, + size_t size __attribute__((unused))) { /* * nolibc does not support buffering so this is a nop. Just check mode From patchwork Thu Aug 3 07:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 709816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9587DC04A94 for ; Thu, 3 Aug 2023 07:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232705AbjHCH26 (ORCPT ); Thu, 3 Aug 2023 03:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232080AbjHCH2w (ORCPT ); Thu, 3 Aug 2023 03:28:52 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 354302D6A; Thu, 3 Aug 2023 00:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047728; bh=iyNHuyFIri0jOYpPmNaXlYmA/yRvazXiYVqNbQvn0aU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E5yZKMaXfMDcQ/MX0pRsZBQWf6pZojYuI1Pwm4z6w7hhVsVENXrH8a1+Ql5rNZR0m bfRAuZ/hwFedoX0F2vuLwV9GNziF3rkJLk9wijv89ehEts6l574XX6RxK4hO8bFdq4 vFyrf1ykG59kT3PVcHZ/PasLqvG8ZaRyKwDwKz0Y= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:48 +0200 Subject: [PATCH v3 04/14] tools/nolibc: sys: avoid implicit sign cast MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-4-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=702; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=iyNHuyFIri0jOYpPmNaXlYmA/yRvazXiYVqNbQvn0aU=; b=SdXAr1nPJemUkaNkDtnvzdItVrwOJcTSgFgDli3ZAyQlj1UF07hIZH3b5znuC4sOs+HytEHEL e3r3dEQzSeVDGMN3vbUKh7fFprXjSduqd+F2TbnPDKo5jBq03UZCaOY X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org getauxval() returns an unsigned long but the overall type of the ternary operator needs to be signed. Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/sys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index c151533ba8e9..833d6c5e86dc 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -466,7 +466,7 @@ static unsigned long getauxval(unsigned long key); static __attribute__((unused)) int getpagesize(void) { - return __sysret(getauxval(AT_PAGESZ) ?: -ENOENT); + return __sysret((int)getauxval(AT_PAGESZ) ?: -ENOENT); } From patchwork Thu Aug 3 07:28:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 709815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63EB9C0015E for ; Thu, 3 Aug 2023 07:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233339AbjHCH27 (ORCPT ); Thu, 3 Aug 2023 03:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A1ED30D5; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=K1nxWE0fnm2Rd+ee1CtTMEzoebCOmluJAHtmf4S2JYw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=d3oYr9ZKnj81yRNQs7tguKWRZj+K+kOD9aCvxHPy9sln2oa8ZNdOGxPxAC3ZyE9o8 6amfOuVyomwybMZoLE5XSQ1VpDwXVFPd25so9KO64tXuyJ8IRl6AtVlAgk/KxCT7Ja abX6rrF3TPhctcQVoi5qTqmXXhgxtxC9mIQ2eJgc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:49 +0200 Subject: [PATCH v3 05/14] tools/nolibc: stdint: use int for size_t on 32bit MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-5-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1072; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=K1nxWE0fnm2Rd+ee1CtTMEzoebCOmluJAHtmf4S2JYw=; b=c9Cgu8bto58cOlvZooH2C/yq8ewDPwtBzS6vev6ZRrqlH0do7tsxTiV75lYiOPpWXJvbOhhxV LWNXjln6xFtC8i/+MTZ4YavCk/Ik+vvihxujZIEb8spYbYMEvi9lw+S X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Otherwise both gcc and clang may generate warnings about type mismatches: sysroot/mips/include/string.h:12:14: warning: mismatch in argument 1 type of built-in function 'malloc'; expected 'unsigned int' [-Wbuiltin-declaration-mismatch] 12 | static void *malloc(size_t len); | ^~~~~~ Signed-off-by: Thomas Weißschuh --- tools/include/nolibc/stdint.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/include/nolibc/stdint.h b/tools/include/nolibc/stdint.h index 4b282435a59a..0f390c3028d8 100644 --- a/tools/include/nolibc/stdint.h +++ b/tools/include/nolibc/stdint.h @@ -15,7 +15,11 @@ typedef unsigned int uint32_t; typedef signed int int32_t; typedef unsigned long long uint64_t; typedef signed long long int64_t; +#if __SIZE_WIDTH__ == 64 typedef unsigned long size_t; +#else +typedef unsigned int size_t; +#endif typedef signed long ssize_t; typedef unsigned long uintptr_t; typedef signed long intptr_t; From patchwork Thu Aug 3 07:28:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 709812 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1242AC04A6A for ; Thu, 3 Aug 2023 07:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233886AbjHCH3F (ORCPT ); Thu, 3 Aug 2023 03:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232169AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B74CC30DA; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=Bsog0Mf6TrXFPK5NCHSwt3Qj4UKD19LdkghQ5BZEmxg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LXyQLw5NM/Oe9Xu12DPpC769c6UF3r50FEMf0cdoLRblw0DhqzHGWRuHqi3XK50w+ 2EmfvwP97/YzHoyvAFDei/E+3a9ApLZFVH3gAySn//QBID7aVm/psgrO3qUXZAbwLj +M7+XGO9B+GjsjPLXmAUgDGYzxpioi81vJXcPDu8= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:52 +0200 Subject: [PATCH v3 08/14] selftests/nolibc: make functions static if possible MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-8-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1835; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Bsog0Mf6TrXFPK5NCHSwt3Qj4UKD19LdkghQ5BZEmxg=; b=6bN7cO3nPs3BnEWlMB22XPWZvlNXbV6YYCr1ADIkFpYMKeskTrlYAiPgsG0Hvx83/fMhS4PFA 8/f1DrEBKcmDIFpU5gdml9rFlW+ibQ4LzIZOimZdANh+Mu98XuXkHSq X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This allows the compiler to generate warnings if they go unused. Functions that are supposed to be used as breakpoints should not be static, so un-statify those if necessary. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 154ec4787e8d..ea420c794536 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -80,7 +80,7 @@ char *itoa(int i) /* returns the error name (e.g. "ENOENT") for common errors, "SUCCESS" for 0, * or the decimal value for less common ones. */ -const char *errorname(int err) +static const char *errorname(int err) { switch (err) { case 0: return "SUCCESS"; @@ -659,7 +659,7 @@ int test_getdents64(const char *dir) return ret; } -static int test_getpagesize(void) +int test_getpagesize(void) { int x = getpagesize(); int c; @@ -688,7 +688,7 @@ static int test_getpagesize(void) return !c; } -static int test_fork(void) +int test_fork(void) { int status; pid_t pid; @@ -713,7 +713,7 @@ static int test_fork(void) } } -static int test_stat_timestamps(void) +int test_stat_timestamps(void) { struct stat st; @@ -793,7 +793,7 @@ int test_mmap_munmap(void) return !!ret; } -static int test_pipe(void) +int test_pipe(void) { const char *const msg = "hello, nolibc"; int pipefd[2]; @@ -1231,7 +1231,7 @@ static const struct test test_names[] = { { 0 } }; -int is_setting_valid(char *test) +static int is_setting_valid(char *test) { int idx, len, test_len, valid = 0; char delimiter; From patchwork Thu Aug 3 07:28:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 709817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A798C001E0 for ; Thu, 3 Aug 2023 07:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbjHCH25 (ORCPT ); Thu, 3 Aug 2023 03:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232107AbjHCH2y (ORCPT ); Thu, 3 Aug 2023 03:28:54 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B7730CF; Thu, 3 Aug 2023 00:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=SiXyuOOX0kAfgATp0YbPKnf7iVUwVHLjveWTNqqssiQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hezgaGxRLIRMLpdr1R+Wsv3oxbMjbLxk5lOLBNIMFPM20GFGmpZ33B3okuHlqkbKW HgN7x0AvLODroFjwDfuWQlRogfJUAZ6pw4K8d2mCWKAuIFmCcxeZHLFA/sFdMBwMda WnwHWZGA2kX48+4+iRUaufOvWrGotJrOx5GN5xms= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:53 +0200 Subject: [PATCH v3 09/14] selftests/nolibc: avoid unused parameter warnings MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-9-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=758; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=SiXyuOOX0kAfgATp0YbPKnf7iVUwVHLjveWTNqqssiQ=; b=Q/BdMVls6YdyJeCvodtEdoB0Szlesfpr7ZaJZrW87s6bj1cDnCYLCF3ffhM7qtMKZ5hSLkYW7 ZitYAgLlZwrD7Al8FbR8+cwSAm5D9sDwv++Rtwpkqg4OY1sSjuEm+vu X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This warning will be enabled later so avoid triggering it. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index ea420c794536..d6aa12c3f9ff 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1112,7 +1112,8 @@ static int smash_stack(void) return 1; } -static int run_protection(int min, int max) +static int run_protection(int min __attribute__((unused)), + int max __attribute__((unused))) { pid_t pid; int llen = 0, status; From patchwork Thu Aug 3 07:28:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 709814 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C790C04A94 for ; Thu, 3 Aug 2023 07:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232987AbjHCH3B (ORCPT ); Thu, 3 Aug 2023 03:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232330AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9606A187; Thu, 3 Aug 2023 00:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=FOosJH/CmUX2d0gi9dET+M4ykNx0gigEkRwzseP0iBQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mFfiRKlyRQ1RA8jAfiLWQNaBJouglzSvWbjxpUEHbrdgJGElid8O7uGRRKCNDkata Lm6yvEGonFX+awVTZ0VkBWNQEqPBau8BSTZTgGH5+LtlRHZ0Fb08Rru/GPjSE7Enoz vZELYSf3f2fXiqXFU385Ds9sucRx16qQJgQR4QpQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:55 +0200 Subject: [PATCH v3 11/14] selftests/nolibc: use correct return type for read() and write() MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-11-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=1419; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=FOosJH/CmUX2d0gi9dET+M4ykNx0gigEkRwzseP0iBQ=; b=4jNwczucEessfNJbJG8Wi2UcI2FKtV4G8+Nx0CetT9ICUSxSaPgKRg7DdIBB2TwdxoPicmrBM D9BTJZbvnjMC78Q4K/x2E3FsSdqFaUiA6M/Oht8hc9RR+eqyUkW82f4 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Avoid truncating values before comparing them. As printf in nolibc doesn't support ssize_t add casts to int for printing. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 0ab241d61508..63f09800057d 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1023,7 +1023,8 @@ int run_stdlib(int min, int max) static int expect_vfprintf(int llen, int c, const char *expected, const char *fmt, ...) { - int ret, fd, w, r; + int ret, fd; + ssize_t w, r; char buf[100]; FILE *memfile; va_list args; @@ -1045,7 +1046,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm va_end(args); if (w != c) { - llen += printf(" written(%d) != %d", w, c); + llen += printf(" written(%d) != %d", (int)w, c); result(llen, FAIL); return 1; } @@ -1059,7 +1060,7 @@ static int expect_vfprintf(int llen, int c, const char *expected, const char *fm fclose(memfile); if (r != w) { - llen += printf(" written(%d) != read(%d)", w, r); + llen += printf(" written(%d) != read(%d)", (int)w, (int)r); result(llen, FAIL); return 1; } From patchwork Thu Aug 3 07:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 709813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD227C001E0 for ; Thu, 3 Aug 2023 07:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233682AbjHCH3D (ORCPT ); Thu, 3 Aug 2023 03:29:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232332AbjHCH2z (ORCPT ); Thu, 3 Aug 2023 03:28:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EB1330E4; Thu, 3 Aug 2023 00:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1691047729; bh=1prHYeNa2m6PDgxlomejHbEUeEH+xZuFmSaJoOFEhcA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RnfIHQ4uiH5HSosRYOtPrfz3SG7UZZdVfxMWZIyctFa6g5w98vl7xf4DoXXEhMOkK ij9Uq5rOn/j0634l3LNLEZZTZdSKgezgZuRdM4SgcuZthdPehKrLCvzxaOaBn3FbJy pPHiA1ZYoR5xGxS52k7Je82P7A6Wm9hVUXeLmAcc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Thu, 03 Aug 2023 09:28:58 +0200 Subject: [PATCH v3 14/14] selftests/nolibc: enable compiler warnings MIME-Version: 1.0 Message-Id: <20230803-nolibc-warnings-v3-14-bcc1a096ae02@weissschuh.net> References: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> In-Reply-To: <20230803-nolibc-warnings-v3-0-bcc1a096ae02@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Yuan Tan , Zhangjin Wu , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691047727; l=921; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=1prHYeNa2m6PDgxlomejHbEUeEH+xZuFmSaJoOFEhcA=; b=gj5nyYlAoM82Al6l1w7dDRxZVxTU9JPlDlrOyLJNu97fgOVQhH4+8ltb5nxU+MiP+nves7IJL z/BUpARrFpkA1mZ/6pgJ8tyToiYcoo9e+OrV7MPLJ/hDUvwY9elLR7H X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org It will help the developers to avoid cruft and detect some bugs. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index b82d29b6c37f..e8d09cbee2ab 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -79,7 +79,7 @@ endif CFLAGS_s390 = -m64 CFLAGS_mips = -EL CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) -CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \ +CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \ $(call cc-option,-fno-stack-protector) \ $(CFLAGS_$(ARCH)) $(CFLAGS_STACKPROTECTOR) LDFLAGS :=