Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4328408rdh; Tue, 28 Nov 2023 19:58:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFg/6hK2BkrnAe8acZ3z2LbsHs8H9qX+UfTXBGHXYkWX5YIxsZiE9fOBlmp/ZJw8H05uqNX X-Received: by 2002:a05:6a20:3caa:b0:189:ca96:aa1b with SMTP id b42-20020a056a203caa00b00189ca96aa1bmr19047063pzj.53.1701230280038; Tue, 28 Nov 2023 19:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701230280; cv=none; d=google.com; s=arc-20160816; b=BiKsvXcBnT6XdYrlbFmmog+9oMI8HGuUvuvubR87cL1LDupsDf7ugqn/Mg5ogB9dCf rm5iUUSHSqUTr1ScWWgSkFCvlW0qnAqvP6OcGUhs+IhBAO8a9Sr2QJ1d1iMpJtR3F9U3 WWq2gTNeERwEO7khi1d7WBQjSZCin31AKXSahwjEu34PxhWR5yRYfrYBg4d0eYPDxh2A pywLM/hVxhgjoHhJ4ZK52oWw7y7eo2FKjzS5fUtLdkFxHwzmWShXV57A+VLYOdBANIIp XatN1c2zEqH0tnsB0AgOkqzm3hneqVLbp9HxWuDi+wf7dewKyn8Gx4MVKGagsizoGgv+ mI2g== 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=vyoXIg6JrBBAUBB/NTLpAdFQ8OKrvEkihh4OK86vyqfiI/YSViVduWkqoJ1TBiQpYA 5LUIZbaQWntXyfo2r3BrPW/drDYopjUxwJJDX0LStZmtSHjvL1bFGW+Qh+sC/yoqqygT b7j6BALbzkcOijXuJVf0RSi0aI30YdquRKK3wnPyCN5P1tvl94SsE3Z7GsFdgk+1X1tG EAnpB83IRX16qV6zNZK3oejpewqsr9zOzyl+bAyfrKGeb3WtMxFmsfWZ1TpbPdwj0j1a q+JPCm956rG/KxYOh8OUAe03R7wV09gW1RjW+QawA1WxCiUtjeqdj7fwfc4rdGAh/oxq QXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=axMIPd3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g12-20020a170902868c00b001cfb79824e0si8358237plo.504.2023.11.28.19.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 19:58:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=axMIPd3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 393A0804B129; Tue, 28 Nov 2023 19:57:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376841AbjK2D5n (ORCPT + 99 others); Tue, 28 Nov 2023 22:57:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbjK2D5m (ORCPT ); Tue, 28 Nov 2023 22:57:42 -0500 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8C6412C; Tue, 28 Nov 2023 19:57:48 -0800 (PST) Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-423d9d508d1so8253451cf.1; Tue, 28 Nov 2023 19:57:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701230268; x=1701835068; 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=axMIPd3LMQGw9JR/mgxmxdzi45GUg7wOaT11eZ3kMc0vSEVwZ260sdBGXLvooX8a9q aov9iD/RWyXHIIDxe9JPjRPtsE63adqT7mfVFcFZAX1lbmlGhNa6gy4OOt2JIbh922oL Cw9JEPUpcHBYu/kqBO0jMUC+tTsHHDhf3qeQrE4m56DQmSjxHavHirDQ+3+j7odOa++V cZMzeraIYcflyQihzRn+gOeQIuLk1DRGMD9+d/8yyHEcDXdENSGCfaVR/Kee63fj5NUc vikaE67j0QqtV2J+BmhAKJSIdmnUrCqPgwGmBMMozqKhp8wOPK/25bJ+VHyB7ro7WLMq epFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701230268; x=1701835068; 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=TZu0BB+JqxH72NLJH10Atq+dAa289ag4+oOB4emw63i3dhDNA5iMxfp4iW9z1Jr34b AYNfa0Z0Wb2y+5UtRlC7IMEI6cFAclzMe5KsK4LE5WHL4JpMzryKAJ1TNrRATNS6UaRS aGOAaMeL3Q80v3o9gABiHiyG7FVICVslZaHd7Z8jfUoULSldzLWmjsyGVpZKfJnh7OR7 w1He4y7o/69eSQe9ngXz4P01nffK9qWnLJh3n/GtOEpbbsg3JsNJKjeP/Jls94MrzbET sXhM0yCLAlBYMgwxFWJWsED9sSihkY5RI/4NWABm56nD05onWdy8Yn1QycGiFU0enB4S NNXw== X-Gm-Message-State: AOJu0Yxx0ehWJK50riYZCkB5+LYmaIMAh8uaFFMdZjnx0FpUl6a+vuc6 CgOKj7+1iuOwHVLtHps4aqiUrV38yun3+g== X-Received: by 2002:ac8:4e81:0:b0:423:852e:8273 with SMTP id 1-20020ac84e81000000b00423852e8273mr21762989qtp.61.1701230267865; Tue, 28 Nov 2023 19:57:47 -0800 (PST) Received: from angquan-linux.. ([72.36.119.4]) by smtp.gmail.com with ESMTPSA id i10-20020ac860ca000000b004199c98f87dsm5139943qtm.74.2023.11.28.19.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 19:57:47 -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] selftests:breakpoints: Fix Format String Warning in breakpoint_test Date: Tue, 28 Nov 2023 21:57:26 -0600 Message-Id: <20231129035726.6273-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=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 19:57:57 -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