Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4160290rdh; Tue, 28 Nov 2023 13:36:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9b+OO/q/l89Q0wJ7LqndpM2cD5w8nONeCA8IuMu3+K4uSDcxx3nJKmLCqzfnzQb/xo5g5 X-Received: by 2002:a9d:6acd:0:b0:6d6:4cf3:d908 with SMTP id m13-20020a9d6acd000000b006d64cf3d908mr17561316otq.33.1701207397595; Tue, 28 Nov 2023 13:36:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701207397; cv=none; d=google.com; s=arc-20160816; b=qZAUrjMJOJaro7lY2p60G8q1cjBO5KdD0BPCO5yAOfaox4jM6dJcpC2axsrjiA71CS Vw1VKBFxRBsQye95SSTaMgSp0eK3dQznBDE4BHte/f75aDOWJUJrMD2ZQ347OajdjtiT hQOywsc082x+6LcZEjxorzYc+YVtBNjcUgx2vk1ZMwzsuin0e9x8rHj3vLH0OPJJsCCA UQQsYw680Vf8Tb4gJFbZJHl/158/61h3AztN6psNrKjH8DzgGmBd5f8e1TNMG1jF2jpV sRNKbew/YL/0rRUy0+XKO7LVdKsTLLi25Mx2Ll16X1HMEzOPrqpnh3EuNUPDsFINBYj+ oNpw== 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; bh=9+7egZpgbxWlQy7x1pNLLDFc7cb12zF09MZ6gXGVBBI=; fh=xr2tRmJO5CCcvERKgUbQiCfZD8weRWjaLLzHWlvNSHA=; b=whlq2G3yTmshzb31qhmT4X/710++jkD09kFRe3D5puBEDBEdxxKNKuM4b6BgJXHpGP p5/a8o3Zxe1HaOL5LoE715ucJ3XhAhB41yUJCjjQc/Kt/1o0fRdKbz7UXZLEVONakek+ OGgov+ITzrSA62y26GSKK61LCpmhf0VVWCwaF5jCIFPs1xWuUfWDj4i/eJQ9X4hgfX38 x4LjMoKAtGuF8z2/lDOptG2BtBIxDVmwGP96RjD7zTOjrWBN2qI9pkHlkcOulqTwg1ni kXFmep5Y+gEjvej8AkLZVxLLeq+Eu+gnuEm799h72p5EvecDe6hvdiUaZjTV4nz08kA9 OVZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bCtp6mL1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bm6-20020a656e86000000b005a0737404a7si14041079pgb.258.2023.11.28.13.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:36:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bCtp6mL1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A9FEB80BD24C; Tue, 28 Nov 2023 13:36:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345025AbjK1VgZ (ORCPT + 99 others); Tue, 28 Nov 2023 16:36:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345696AbjK1VgM (ORCPT ); Tue, 28 Nov 2023 16:36:12 -0500 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 406282D56; Tue, 28 Nov 2023 13:36:18 -0800 (PST) Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-77d708e4916so314314085a.3; Tue, 28 Nov 2023 13:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701207377; x=1701812177; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9+7egZpgbxWlQy7x1pNLLDFc7cb12zF09MZ6gXGVBBI=; b=bCtp6mL1ul/UWguDZAwtY/6sx3jH4/Ej34/IZyhHTEd0nU2A7WGCyP5nl0Nuue9vx4 KMRTMPJbTGptvB4OAcVDFwmcfEPJy3iCUaMbns2ibPDoCNPVRWz9LGXbp3ZTqlQkkake NM3cOHK+NJKBmVgm64Bgxxfyx/QuL+Op+53EhhAOh/k1SnKdIFrj6SYTczalDF1RWRQy oLnzSPoAIJ466rr44DGTMGB3Tr08kkO08L5vAySj84XaVrmKGgJDQtAXdl/VeNRcez0g dXpn2s72HUXzn402sHv/jc4FLVAmvBUBA31aSGI3p+1rUNoZJkkRrbC6zfVXZupCvLMY 9W7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701207377; x=1701812177; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9+7egZpgbxWlQy7x1pNLLDFc7cb12zF09MZ6gXGVBBI=; b=HER3tA758eiCu+RcOoilS9pmPVay/QDLYIxc3vo0yzNAH89qsdfbutu+Hd5sC7eZeJ w5DIzeJLnlcxBwty9SxV5qzGcm23HY6S60cuWy2NEnXJzsYOp9aSulQpV8kEHESpcKcP aF9zysrcO6DK4GG76LGdm308kUN5wlLu4qrZAWrsa/7o7Sru9vMQ9czAAhSVzCkS8+fv wxas+67ZcPbXAiKq0weuJDDVsW0nz6Bo1DiXy8cuRi0Dh/xEvmlQB5rsaSqkcO1L6NGU pZ4S1wlySoK1i85vNp6b3t2XgMU3jKF0BuJrU7QsQlHbhFNdUeL6QsbjFrw65DFS98VN PS3A== X-Gm-Message-State: AOJu0YykKIgbyZD1GKTWvjpSx6ye6o/rFVPJcLZ3PY/g4SivJuKA2M7B 2WEx+dxGjBje/sJJcS74BhDeAcqfsU4pbQ== X-Received: by 2002:a05:620a:852f:b0:778:9156:3f07 with SMTP id pe47-20020a05620a852f00b0077891563f07mr16334065qkn.24.1701207377382; Tue, 28 Nov 2023 13:36:17 -0800 (PST) Received: from angquan-linux.. ([72.36.119.4]) by smtp.gmail.com with ESMTPSA id q5-20020a05620a0c8500b00775bb02893esm4819851qki.96.2023.11.28.13.36.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:36:17 -0800 (PST) From: angquan yu X-Google-Original-From: angquan yu To: skhan@linuxfoundation.org Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, angquan yu Subject: [PATCH] Fix Format String Warning in breakpoint_test Date: Tue, 28 Nov 2023 15:36:07 -0600 Message-Id: <20231128213607.59587-1-angquan21@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 28 Nov 2023 13:36:36 -0800 (PST) From: angquan yu This commit resolves a compiler warning regardingthe use of non-literal format strings in breakpoint_test.c. The functions `ksft_test_result_pass` and `ksft_test_result_fail` were previously called with a variable `msg` directly, which could potentially lead to format string vulnerabilities. Changes made: - Modified the calls to `ksft_test_result_pass` and `ksft_test_result_fail` by adding a "%s" format specifier. This explicitly declares `msg` as a string argument, adhering to safer coding practices and resolving the compiler warning. This change does not affect the functional behavior of the code but ensures better code safety and compliance with recommended C programming standards. The previous warning is "breakpoint_test.c:287:17: warning: format not a string literal and no format arguments [-Wformat-security] 287 | ksft_test_result_pass(msg); | ^~~~~~~~~~~~~~~~~~~~~ breakpoint_test.c:289:17: warning: format not a string literal and no format arguments [-Wformat-security] 289 | ksft_test_result_fail(msg); | " Signed-off-by: angquan yu --- tools/testing/selftests/breakpoints/breakpoint_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/breakpoints/breakpoint_test.c b/tools/testing/selftests/breakpoints/breakpoint_test.c index 3266cc929..d46962a24 100644 --- a/tools/testing/selftests/breakpoints/breakpoint_test.c +++ b/tools/testing/selftests/breakpoints/breakpoint_test.c @@ -284,9 +284,9 @@ static void check_success(const char *msg) nr_tests++; if (ret) - ksft_test_result_pass(msg); + ksft_test_result_pass("%s", msg); else - ksft_test_result_fail(msg); + ksft_test_result_fail("%s", msg); } static void launch_instruction_breakpoints(char *buf, int local, int global) -- 2.39.2