Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2598117lqb; Tue, 28 May 2024 05:12:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUr/USgq2uGbuaMi0v6viNryf56Ns40WEBzM9Epz4rgvnG6bGrFHuH5ALds7lQ6A3n1f6M+qMvbnYX+DfmWUIUISOlXWTGvUHwQHmI7Kw== X-Google-Smtp-Source: AGHT+IGSpnk/uznjRSQ7qijDhsFButo1ApmgSVGXqVYnsQPJMtFFXvt7u1WPBdFQHjeuAxMKXgR8 X-Received: by 2002:ac2:4475:0:b0:51d:162e:bfed with SMTP id 2adb3069b0e04-5296746524dmr10528244e87.68.1716898353999; Tue, 28 May 2024 05:12:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716898353; cv=pass; d=google.com; s=arc-20160816; b=g1erUTeWGEvUz1MbFEOOHjfWi3Oli8oHNIzAG58Wu8XVSakd8mX0SAt6MurY0BUkcs HUtbAkmDGAsZLzfIee1dXoLnH/msVIP4UZ9V4G1cjkgIaZ/Zemy/PmhgGsAfdwkO8vgu xyq5g8cJpbVT+HM5SsXmnCkCSJ2TDwT2PvRFVK0XQHZZxDSc5w4NHmH7d+UqxnpChosS fAqCQPojO2UomKxxHGo1CqRF+yDCvDjsAymsmZUrl/vTf+sgqKyxS7D/oZCv4MLVoqBm 5Js7EAGw7KpoQVsNx1vVqD4/XOyQe4S13sjPW9/tFFpAiXMz30befdKW9YdQhxjHLPs4 AL2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=IOahbxj4dWi/QK1yyEpbrxLkdlLLT461148NFwKjgBI=; fh=E+a6tCQ2dadwDewOhH7KEnPZ/NUXHZ1FKjjvlQFC0ww=; b=dAPAD/aaR1DRcj0UgOKVBwIjTkV8a0xpHw4cxt3htcLA0k9ufVBSRQCr7f20DCwrD1 t2ujeOQAt/45i9x94HhPl3MMFe/6iTqMnxAm6MZBzGsz20O290FiFQWBBlZvwfB7IMfp 3p3EvLKFnVCXNCF6lq908+cQqkTYgJE0420Cr+DHo3scp/aBP8CHu0sMpkyX+/w5Kibi /sTA9vpNqb4lrjeTEJeJT8/9Q/N6mLrHc/5VSvv5csPfXeRuhYaZ7fyaoqprV2ii9vVK SjjrJLNpjSHIRR2lQK9E88RZK7xLLiIFy/DvUi/KYtKMkk7MKZLR9OnFsR527/bRw3cb E7Nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MJSyZlHI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578628feacasi4409062a12.163.2024.05.28.05.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 05:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MJSyZlHI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192259-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AB3041F2449F for ; Tue, 28 May 2024 12:12:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EC2016D9B8; Tue, 28 May 2024 12:12:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MJSyZlHI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58F4516D9AA for ; Tue, 28 May 2024 12:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716898319; cv=none; b=LM7qWwXylcay5GrbkcImJSEuUe2RX36V/Xu6UhUaveremVyc7b6OlhtBLbjpA/vmRRabpyZhoPayj3Nds+vAhar5Qy3mf/V2kkautAcL2AksioAwD0wuAih56dQZxCOdIwfUHz3t165z9mBtN5IAZaIqJanUskQgq6ypgr1NhnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716898319; c=relaxed/simple; bh=9oJf2W4YAfo1/U1RW70Nztdk9rsBysYzDxvEI53bdjs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kxaRpGux9ToQ97nL1Qlb+M/TfdJh5tCDICc1JRRyGnURa7RIpv2rEE+bqIdjsfbG6D2Lt5tXTEYqQuaMh2NQNd3HNNYnyUbRbTcZYMG6bNcfxNzOhLDdwoQrwcMpFob+tFkgHD+aCJ3DG3jf6SBpl9fT0XFhvsCdXdhIsEA41sk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MJSyZlHI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD1A3C32782; Tue, 28 May 2024 12:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716898319; bh=9oJf2W4YAfo1/U1RW70Nztdk9rsBysYzDxvEI53bdjs=; h=From:To:Cc:Subject:Date:From; b=MJSyZlHI0WYHrLNyrRjCTzSWsdD2LVY3KA0gAIpOJg/d5RvdhncnoFz/WoXlKEf3+ Iko7OBFXWIla86aPmDZNNm3eRW86dPBME03RXXvWdyXMg1zMjHKml1ZKolsu0e96UE d5a/zRh7Z0ljpIbY2JftU9WpIuwPmO0U7ZVQKk+dW9esXzBimvK4UnuaFSU6JGB6zk 0FWSNDLkuvwYRv2ETvdT997UOKhde/cH2G2hKEklOBLQV1xcsHiy7hHF2O5HZs61gj 9wg2gV1raSuOT6+nHFdbjDJhOn6Fti/sxsoug7tLBVbQ+1EHJh0c6a7lq7JFxhLULY 37SjnGU2nruNw== From: Arnd Bergmann To: Jason Wessel , Daniel Thompson Cc: Arnd Bergmann , Douglas Anderson , Petr Mladek , Sergey Senozhatsky , Justin Stitt , John Ogness , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] kdb: address -Wformat-security warnings Date: Tue, 28 May 2024 14:11:48 +0200 Message-Id: <20240528121154.3662553-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann When -Wformat-security is not disabled, using a string pointer as a format causes a warning: kernel/debug/kdb/kdb_io.c: In function 'kdb_read': kernel/debug/kdb/kdb_io.c:365:36: error: format not a string literal and no format arguments [-Werror=format-security] 365 | kdb_printf(kdb_prompt_str); | ^~~~~~~~~~~~~~ kernel/debug/kdb/kdb_io.c: In function 'kdb_getstr': kernel/debug/kdb/kdb_io.c:456:20: error: format not a string literal and no format arguments [-Werror=format-security] 456 | kdb_printf(kdb_prompt_str); | ^~~~~~~~~~~~~~ Use an explcit "%s" format instead. Signed-off-by: Arnd Bergmann --- kernel/debug/kdb/kdb_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 3131334d7a81..7da3fa7beffd 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -362,7 +362,7 @@ static char *kdb_read(char *buffer, size_t bufsize) if (i >= dtab_count) kdb_printf("..."); kdb_printf("\n"); - kdb_printf(kdb_prompt_str); + kdb_printf("%s", kdb_prompt_str); kdb_printf("%s", buffer); if (cp != lastchar) kdb_position_cursor(kdb_prompt_str, buffer, cp); @@ -453,7 +453,7 @@ char *kdb_getstr(char *buffer, size_t bufsize, const char *prompt) { if (prompt && kdb_prompt_str != prompt) strscpy(kdb_prompt_str, prompt, CMD_BUFLEN); - kdb_printf(kdb_prompt_str); + kdb_printf("%s", kdb_prompt_str); kdb_nextline = 1; /* Prompt and input resets line number */ return kdb_read(buffer, bufsize); } -- 2.39.2