Message ID | 20230610235016.438460-1-mirsad.todorovac@alu.unizg.hr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1804525vqr; Sat, 10 Jun 2023 18:00:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6kT1ovFrZlNm5izdbYc0xJAROMDIgCTYtE0NZhJAmIiF+iqDQxE7eWmFTAoOlGucVK2hEd X-Received: by 2002:a17:907:31c2:b0:960:ddba:e5c3 with SMTP id xf2-20020a17090731c200b00960ddbae5c3mr6255323ejb.32.1686445256895; Sat, 10 Jun 2023 18:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686445256; cv=none; d=google.com; s=arc-20160816; b=p3ubV5IXY0yIAdPLuVNLvNbleOzwgFlhw4puGPiKAxzSmJXvh+f0PCZIVUGy8X6xGu 1Mr5D4MbVJrQ6sS6GN5HdIkpRBWIEkXQJQmX41+H8HpvHGanxXf6Lh/f7EA8e1zZCM0o qVnmRbIMZ//HAVA+kgxz9817+xQ2QjLJKuN8QCmzH99EVsaClmUzw8Yzr+roPulGqys5 gjTZqkcMdQWRrgd5MYhSS04IxnimZ7FYfonp7MBpD692b5wyuL89CEWERtIwmW2eZHRc UKjJLLokSLpno9a9LbJVWLGZy16Wx2bic7cLFnZaauCKcrOA4QS/KCBinchiGMEE6jPk LGQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=PyfLDo2O8yGfBZTW5eznG4aARyQsbXCl/jow7xuBumQ=; b=Bf9dhmiLABh2FF9jXqvpDWFYaxNHxjTS0yKQMe5S+4FFjkijG/1Hkt+QWYx9b+n6OM ngU90joUgE/AjKujolKbxCDQEbwjR0aivUlvJ4sq2hYt/kCInWe+TRA4KeYJ78iWW3o3 o2DQ/j6K3VfhDtQ6xfHrWIxQKj9f8Zqnee+Ec1Ma8FdNi73s1Mm7xtxkJ8C9meiM/+t+ xPrADNbNUTZ02LVC4aM2f9HFfQhWwAlXBKoRaq/jh/XJ/pPprrlrC/eCy8aFYqf0NPvT q9IrlH7EVd0xpcofEUdI4VB78p9VsEAspEQpHJNjDIzkWmB1XIzGkMIzVsC8op5BjJZW oV5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=Dii5rFne; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=Ax0GnqZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a50ee87000000b00516aedf2feesi3819742edr.460.2023.06.10.18.00.27; Sat, 10 Jun 2023 18:00:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=Dii5rFne; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=Ax0GnqZE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232871AbjFJXv4 (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Sat, 10 Jun 2023 19:51:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjFJXvy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 10 Jun 2023 19:51:54 -0400 Received: from domac.alu.hr (domac.alu.unizg.hr [IPv6:2001:b68:2:2800::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A6F3198C; Sat, 10 Jun 2023 16:51:51 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 01D4360174; Sun, 11 Jun 2023 01:51:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1686441109; bh=v4wXQstgWeUzNRuDlXeZ8k492Buj4zZppclAsNx/yB4=; h=From:To:Cc:Subject:Date:From; b=Dii5rFne6vQCW9tPVWTBPZfQD9cKJZr0IX09PnedfUe59CevjhlVSnf7vnT5hKyk0 qKygj+FbvV1XkQ9bdwOMmgb1Bv+xfNhCHrrScFKSuGQ71wqdBl0E7bfZKPs+CdgSlA ompFrtstnS1zKr0aBgGkDyodk3FzaDGHEj5Ok0dcjPgkSV/A7aJBBEtaTWagoFmYeC 92jOPmOLTyDpFeKhESZPWi2Kwbu6OhQ2MDD3n6L44EFBVEa3fnm6CtstSdrPGLfuG2 YwubeJBlc6g7n5zv8u9mdsHlPxoJyE4wYdQ526P18zpRGPyBk09rjugURRGOrMsbAY B5xAM1+MVekyQ== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IcQZa6_0euSK; Sun, 11 Jun 2023 01:51:46 +0200 (CEST) Received: from defiant.. (unknown [77.237.113.62]) by domac.alu.hr (Postfix) with ESMTPSA id CC09F60173; Sun, 11 Jun 2023 01:51:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1686441105; bh=v4wXQstgWeUzNRuDlXeZ8k492Buj4zZppclAsNx/yB4=; h=From:To:Cc:Subject:Date:From; b=Ax0GnqZEGEiKjzWp2X8g3TpxfKrmXMmc4mK34qRy/toO5JyJKu0vIiWuOC7aUtO5z MRQh5299/46M+zzYmF833FRbJd18AoO0eOpgQ6M8SZKxJ9u481JixJtcJS9hlGjqD4 Su3Kn/YHyKb2av43WHmUHaEjKqBOtI26zxOgMftraBQS3+sqQpJTqcMGbKnEovciaf xcSvY1gzqqIQbl+JUU/dhm6Tj7rdMVEbT1zg9zSMrQ1YlKfON3j5NB5LfezKvUZoE9 u2NQd0fxmR1r7XMtO3rhPXyLRgd6vU6Y/t9vwxsRYs19FcZkUTf0xq8kNut4MYImXi BA90bYGJKAzqQ== From: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> To: Peter Xu <peterx@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Shuah Khan <shuah@kernel.org>, Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> Subject: [PATCH v1 1/1] selftests: mm: uufd-unit-tests: remove a format warning in printf Date: Sun, 11 Jun 2023 01:50:17 +0200 Message-Id: <20230610235016.438460-1-mirsad.todorovac@alu.unizg.hr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768366021603347645?= X-GMAIL-MSGID: =?utf-8?q?1768366021603347645?= |
Series |
[v1,1/1] selftests: mm: uufd-unit-tests: remove a format warning in printf
|
|
Commit Message
Mirsad Todorovac
June 10, 2023, 11:50 p.m. UTC
GCC 11.3.0 issued warnings about macros and types of arguments [edited]:
gcc -Wall -I ../tools/testing/selftests/../../.. \
-I ../tools/testing/selftests/../../../tools/include/uapi \
-isystem ../usr/include -no-pie uffd-unit-tests.c vm_util.c \
uffd-common.c -lrt -lpthread -o \
../tools/testing/selftests/mm/uffd-unit-tests
uffd-unit-tests.c: In function ‘main’:
uffd-unit-tests.c:1198:41: warning: format not a string literal and no \
format arguments [-Wformat-security]
1198 | uffd_test_start(test_name);
| ^~~~~~~~~
uffd-unit-tests.c:100:24: note: in definition of macro ‘uffd_test_start’
100 | printf(__VA_ARGS__); \
| ^~~~~~~~~~~
uffd-unit-tests.c:1205:33: warning: format not a string literal and no \
format arguments [-Wformat-security]
1205 | uffd_test_skip(errmsg);
| ^~~~~~~~~~~~~~
The macros are defined as:
#define uffd_test_start(...) do { \
printf("Testing "); \
printf(__VA_ARGS__); \
printf("... "); \
fflush(stdout); \
} while (0)
#define uffd_test_skip(...) do { \
printf("skipped [reason: "); \
printf(__VA_ARGS__); \
printf("]\n"); \
ksft_inc_xskip_cnt(); \
} while (0)
Minor workaround, adding "%s" first argument to macro expansion calls seems
to be the easiest way to eliminate the warnings.
Cc: Peter Xu <peterx@redhat.com>
Cc: linux-mm@kvack.org
Cc: linux-kselftest@vger.kernel.org
Fixes: 43759d44dc34 ("selftests/mm: add uffdio register ioctls test")
Fixes: 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test")
Signed-off-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
---
tools/testing/selftests/mm/uffd-unit-tests.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
The fix has already been picked up by Andew in mm unstable: https://lore.kernel.org/all/20230607023727.0E011C433D2@smtp.kernel.org On 6/11/23 4:50 AM, Mirsad Todorovac wrote: > GCC 11.3.0 issued warnings about macros and types of arguments [edited]: > > gcc -Wall -I ../tools/testing/selftests/../../.. \ > -I ../tools/testing/selftests/../../../tools/include/uapi \ > -isystem ../usr/include -no-pie uffd-unit-tests.c vm_util.c \ > uffd-common.c -lrt -lpthread -o \ > ../tools/testing/selftests/mm/uffd-unit-tests > uffd-unit-tests.c: In function ‘main’: > uffd-unit-tests.c:1198:41: warning: format not a string literal and no \ > format arguments [-Wformat-security] > 1198 | uffd_test_start(test_name); > | ^~~~~~~~~ > uffd-unit-tests.c:100:24: note: in definition of macro ‘uffd_test_start’ > 100 | printf(__VA_ARGS__); \ > | ^~~~~~~~~~~ > uffd-unit-tests.c:1205:33: warning: format not a string literal and no \ > format arguments [-Wformat-security] > 1205 | uffd_test_skip(errmsg); > | ^~~~~~~~~~~~~~ > > The macros are defined as: > > #define uffd_test_start(...) do { \ > printf("Testing "); \ > printf(__VA_ARGS__); \ > printf("... "); \ > fflush(stdout); \ > } while (0) > > #define uffd_test_skip(...) do { \ > printf("skipped [reason: "); \ > printf(__VA_ARGS__); \ > printf("]\n"); \ > ksft_inc_xskip_cnt(); \ > } while (0) > > Minor workaround, adding "%s" first argument to macro expansion calls seems > to be the easiest way to eliminate the warnings. > > Cc: Peter Xu <peterx@redhat.com> > Cc: linux-mm@kvack.org > Cc: linux-kselftest@vger.kernel.org > Fixes: 43759d44dc34 ("selftests/mm: add uffdio register ioctls test") > Fixes: 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test") > Signed-off-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> > --- > tools/testing/selftests/mm/uffd-unit-tests.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c > index 269c86768a02..d356dd271c84 100644 > --- a/tools/testing/selftests/mm/uffd-unit-tests.c > +++ b/tools/testing/selftests/mm/uffd-unit-tests.c > @@ -1195,14 +1195,14 @@ int main(int argc, char *argv[]) > snprintf(test_name, sizeof(test_name), > "%s on %s", test->name, mem_type->name); > > - uffd_test_start(test_name); > + uffd_test_start("%s", test_name); > if (!uffd_feature_supported(test)) { > uffd_test_skip("feature missing"); > continue; > } > if (uffd_setup_environment(&args, test, mem_type, > &errmsg)) { > - uffd_test_skip(errmsg); > + uffd_test_skip("%s", errmsg); > continue; > } > test->uffd_fn(&args);
Apologies Muhammad then, didn't follow that branch. Regards, Mirsad On 6/11/23 14:30, Muhammad Usama Anjum wrote: > The fix has already been picked up by Andew in mm unstable: > > https://lore.kernel.org/all/20230607023727.0E011C433D2@smtp.kernel.org > > On 6/11/23 4:50 AM, Mirsad Todorovac wrote: >> GCC 11.3.0 issued warnings about macros and types of arguments [edited]: >> >> gcc -Wall -I ../tools/testing/selftests/../../.. \ >> -I ../tools/testing/selftests/../../../tools/include/uapi \ >> -isystem ../usr/include -no-pie uffd-unit-tests.c vm_util.c \ >> uffd-common.c -lrt -lpthread -o \ >> ../tools/testing/selftests/mm/uffd-unit-tests >> uffd-unit-tests.c: In function ‘main’: >> uffd-unit-tests.c:1198:41: warning: format not a string literal and no \ >> format arguments [-Wformat-security] >> 1198 | uffd_test_start(test_name); >> | ^~~~~~~~~ >> uffd-unit-tests.c:100:24: note: in definition of macro ‘uffd_test_start’ >> 100 | printf(__VA_ARGS__); \ >> | ^~~~~~~~~~~ >> uffd-unit-tests.c:1205:33: warning: format not a string literal and no \ >> format arguments [-Wformat-security] >> 1205 | uffd_test_skip(errmsg); >> | ^~~~~~~~~~~~~~ >> >> The macros are defined as: >> >> #define uffd_test_start(...) do { \ >> printf("Testing "); \ >> printf(__VA_ARGS__); \ >> printf("... "); \ >> fflush(stdout); \ >> } while (0) >> >> #define uffd_test_skip(...) do { \ >> printf("skipped [reason: "); \ >> printf(__VA_ARGS__); \ >> printf("]\n"); \ >> ksft_inc_xskip_cnt(); \ >> } while (0) >> >> Minor workaround, adding "%s" first argument to macro expansion calls seems >> to be the easiest way to eliminate the warnings. >> >> Cc: Peter Xu <peterx@redhat.com> >> Cc: linux-mm@kvack.org >> Cc: linux-kselftest@vger.kernel.org >> Fixes: 43759d44dc34 ("selftests/mm: add uffdio register ioctls test") >> Fixes: 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test") >> Signed-off-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> >> --- >> tools/testing/selftests/mm/uffd-unit-tests.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c >> index 269c86768a02..d356dd271c84 100644 >> --- a/tools/testing/selftests/mm/uffd-unit-tests.c >> +++ b/tools/testing/selftests/mm/uffd-unit-tests.c >> @@ -1195,14 +1195,14 @@ int main(int argc, char *argv[]) >> snprintf(test_name, sizeof(test_name), >> "%s on %s", test->name, mem_type->name); >> >> - uffd_test_start(test_name); >> + uffd_test_start("%s", test_name); >> if (!uffd_feature_supported(test)) { >> uffd_test_skip("feature missing"); >> continue; >> } >> if (uffd_setup_environment(&args, test, mem_type, >> &errmsg)) { >> - uffd_test_skip(errmsg); >> + uffd_test_skip("%s", errmsg); >> continue; >> } >> test->uffd_fn(&args); >
On 6/12/23 5:11 AM, Mirsad Goran Todorovac wrote: > Apologies Muhammad then, didn't follow that branch. No problem. > > Regards, > Mirsad > > On 6/11/23 14:30, Muhammad Usama Anjum wrote: >> The fix has already been picked up by Andew in mm unstable: >> >> https://lore.kernel.org/all/20230607023727.0E011C433D2@smtp.kernel.org >> >> On 6/11/23 4:50 AM, Mirsad Todorovac wrote: >>> GCC 11.3.0 issued warnings about macros and types of arguments [edited]: >>> >>> gcc -Wall -I ../tools/testing/selftests/../../.. \ >>> -I ../tools/testing/selftests/../../../tools/include/uapi \ >>> -isystem ../usr/include -no-pie uffd-unit-tests.c vm_util.c \ >>> uffd-common.c -lrt -lpthread -o \ >>> ../tools/testing/selftests/mm/uffd-unit-tests >>> uffd-unit-tests.c: In function ‘main’: >>> uffd-unit-tests.c:1198:41: warning: format not a string literal and no \ >>> format arguments [-Wformat-security] >>> 1198 | uffd_test_start(test_name); >>> | ^~~~~~~~~ >>> uffd-unit-tests.c:100:24: note: in definition of macro ‘uffd_test_start’ >>> 100 | printf(__VA_ARGS__); \ >>> | ^~~~~~~~~~~ >>> uffd-unit-tests.c:1205:33: warning: format not a string literal and no \ >>> format arguments [-Wformat-security] >>> 1205 | uffd_test_skip(errmsg); >>> | ^~~~~~~~~~~~~~ >>> >>> The macros are defined as: >>> >>> #define uffd_test_start(...) do { \ >>> printf("Testing "); \ >>> printf(__VA_ARGS__); \ >>> printf("... "); \ >>> fflush(stdout); \ >>> } while (0) >>> >>> #define uffd_test_skip(...) do { \ >>> printf("skipped [reason: "); \ >>> printf(__VA_ARGS__); \ >>> printf("]\n"); \ >>> ksft_inc_xskip_cnt(); \ >>> } while (0) >>> >>> Minor workaround, adding "%s" first argument to macro expansion calls seems >>> to be the easiest way to eliminate the warnings. >>> >>> Cc: Peter Xu <peterx@redhat.com> >>> Cc: linux-mm@kvack.org >>> Cc: linux-kselftest@vger.kernel.org >>> Fixes: 43759d44dc34 ("selftests/mm: add uffdio register ioctls test") >>> Fixes: 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test") >>> Signed-off-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr> >>> --- >>> tools/testing/selftests/mm/uffd-unit-tests.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c >>> b/tools/testing/selftests/mm/uffd-unit-tests.c >>> index 269c86768a02..d356dd271c84 100644 >>> --- a/tools/testing/selftests/mm/uffd-unit-tests.c >>> +++ b/tools/testing/selftests/mm/uffd-unit-tests.c >>> @@ -1195,14 +1195,14 @@ int main(int argc, char *argv[]) >>> snprintf(test_name, sizeof(test_name), >>> "%s on %s", test->name, mem_type->name); >>> - uffd_test_start(test_name); >>> + uffd_test_start("%s", test_name); >>> if (!uffd_feature_supported(test)) { >>> uffd_test_skip("feature missing"); >>> continue; >>> } >>> if (uffd_setup_environment(&args, test, mem_type, >>> &errmsg)) { >>> - uffd_test_skip(errmsg); >>> + uffd_test_skip("%s", errmsg); >>> continue; >>> } >>> test->uffd_fn(&args); >>
diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index 269c86768a02..d356dd271c84 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -1195,14 +1195,14 @@ int main(int argc, char *argv[]) snprintf(test_name, sizeof(test_name), "%s on %s", test->name, mem_type->name); - uffd_test_start(test_name); + uffd_test_start("%s", test_name); if (!uffd_feature_supported(test)) { uffd_test_skip("feature missing"); continue; } if (uffd_setup_environment(&args, test, mem_type, &errmsg)) { - uffd_test_skip(errmsg); + uffd_test_skip("%s", errmsg); continue; } test->uffd_fn(&args);