Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4141591rdh; Tue, 28 Nov 2023 13:02:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEX2zh+TC5nKOOAOb9HQXF0+WOBMu+mADp69PcIFZD66Cr37SxL23AXfHDbEKp2qwX4yo6m X-Received: by 2002:a17:90a:e7cf:b0:280:9074:eb36 with SMTP id kb15-20020a17090ae7cf00b002809074eb36mr17611567pjb.14.1701205369113; Tue, 28 Nov 2023 13:02:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701205369; cv=none; d=google.com; s=arc-20160816; b=xkDeQ+7a0JCO65ROfIjCecYpQBAnx5oP/4YMWjNI/MHd3tdrQladvpsrI2YvKnD0CU pBt5fMcuoSRLYGjEx21pxUjUDrfMHLKb5xTgDnYWnfFzSMoZZkIFyE+haA+Xy69FE6Z9 +2CIejbfoVaZ+JYtpPCm4PLLBWbaCRhw9eu1TxBbuJXPFzZdUPLb33W3VvCIEL4NAqZe UiZ0s95MkUroBZA3+khefjOhjJI7VAQQiFllydqHnmDjqM83+gFqzwsbNDmIeZIW+Izu FU/kWmdD8I85eAEZFXIonPNbL1zUuRSbusfjgGVCEP7zR8AZtG/K5e/o3V5HU87XUaPi /66g== 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=lT15jciCT2KDSP7GXuW5fi6/uGGA1pxkJurLodhpO2Q=; b=kx5beS2i+WN6EYz7a/Yh5kwsJYYCafFztd7JHT1ihxrQwzGaoAyGzt8pfZpldb+Hiw HX5sR65kVbFdgS4p6GPLdiI5imRuy06P/XOj/YZki3ORUSv4k/zo0DyjIjllDk8QKpKX orcupPOrwh4pmuKN472P79pfc/PZFokDXIzkzbA6h7RbKIvzcJxsXVBVsoascdMoJ8Rm Al/9U2AUWFj3c9dbDNEJgElit9Pfudtc8ynRnLAC+d2lvuf2cXZsiLFA7Mo2B8s+Bdsd vidfthgnDYf4zKD9LC6iIHVHk6KnLj15Hwfuz2/8kzWISqGi+ydsZILH2btNcj1Cjgce TMMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=flo9Wp7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id p3-20020a17090adf8300b002851a01b0absi12679397pjv.151.2023.11.28.13.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:02:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=flo9Wp7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 52BD880511B3; Tue, 28 Nov 2023 13:02:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346122AbjK1VC0 (ORCPT + 99 others); Tue, 28 Nov 2023 16:02:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344533AbjK1VCZ (ORCPT ); Tue, 28 Nov 2023 16:02:25 -0500 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5A539D; Tue, 28 Nov 2023 13:02:31 -0800 (PST) Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-67a48761e96so13174016d6.1; Tue, 28 Nov 2023 13:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701205351; x=1701810151; 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=flo9Wp7WqFxYcnDRVlIADypEJg813kdmo7cm1Yhfmx7tEfr4TEo/PE87pb/MfuxBaO 6qSD5EvoU3JeV2+qzaICsGiHoRVzrn7wIG5pLKQkzS8WVK6rDVD+y5S6NT2dX0ZY0rn6 b/SOidcj/dAHsr4MDWRKsFhb7hkwxbi8OpN3NZ6sMCb1fQ8Iq4vlJXeeCY0CUl389PW0 Q5l0jIy8qfhe2oOX3DlW0tTsXBOStxwei5gODA11+rZuFPRWlc3YkUPImRfzyPMam7ld qrO1A80qZQTYWd9JouUkjkaYsiWusUK5+i3VG3++wmvfWyXMLuFL4h9f9TyfTJUG+oks YXTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701205351; x=1701810151; 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=E9zb6re2CNqBC/1PhPece83dNWldQyIU9tGYl1DWn6O05TeevIdDsjdW45Qe3FdGMj FxqvEzkr68fIdLq0U7EEFJQ4fSzBP6QHxwzHAsrrl6bw8+sNfxpdzFx6sDUdBrWFKUzD z1kUnIbAAltD1PYl5bAJU+8X04/nm8k1x7HD7z7wTKNxZ4FUOCJFoxqsEAu8rMQ86k32 fbLn0pzBOneFEPZt1dVgcYrde5R1mg6d5pU5aEQzs//8qpfxIG4jvuJN3UKAF7elamzj TB4KDel7dG2d/S6Jd/rmFmPlHJOyHrSBojRUjjQM/9SnMQKOE3Vejox/Fj7ZISvpdsSA eCPA== X-Gm-Message-State: AOJu0YwRdfWMxe+cyn+2OAsag9HWrEUcinfD/EJ3ViGEKZF31AEQqU+g 36DqiPSaa2QuXeGCpUuEMWc= X-Received: by 2002:ad4:5cc7:0:b0:67a:4da4:e23c with SMTP id iu7-20020ad45cc7000000b0067a4da4e23cmr8302455qvb.56.1701205350707; Tue, 28 Nov 2023 13:02:30 -0800 (PST) Received: from angquan-linux.. ([72.36.119.4]) by smtp.gmail.com with ESMTPSA id ee17-20020a05620a801100b0077d84ad9744sm3748037qkb.36.2023.11.28.13.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 13:02:30 -0800 (PST) From: angquan yu X-Google-Original-From: angquan yu To: shuah@kernel.org Cc: 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:02:06 -0600 Message-Id: <20231128210206.56868-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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 28 Nov 2023 13:02:41 -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