From mboxrd@z Thu Jan 1 00:00:00 1970 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 366761A2C35; Thu, 15 Aug 2024 14:19:12 +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=1723731553; cv=none; b=Oa3Tsj4m8/AkX8QZ+kWtLPqDkCraF1JS2uJeaCctTpvqGR1NDpkET0j3DgFU+Tdukg6Smw3hvMBTty8BGVKTrBI4TdBlHxpHJfqxNV5VSApeA4/Ehoq5/qhqHVs+PyRwxsJ7hzeAtYm1RYFcNDIWhQv49pJUrYrdndw/GSCpEP4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723731553; c=relaxed/simple; bh=OZKD8M85Hf0J4ZIvRZrVgi4len/NbVOSnWlx5QiL1LE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b051z9X6xb23qbBQek3HY/D0FGUgIegFgEUEJW7AJga7XporiR0yLJOAe4+VLKIM3/9mFLFVfhgYCSQaIL8AJ1dZ4pmzsodG257GYcX583XdU8eSrQXAU260pVzv1WY1OwJDEboY7nfHqKrxv68udvwyTaQsWFYEZQ/KpDGVLyw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XU2XwOYe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XU2XwOYe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 530AEC4AF0F; Thu, 15 Aug 2024 14:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723731552; bh=OZKD8M85Hf0J4ZIvRZrVgi4len/NbVOSnWlx5QiL1LE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XU2XwOYeDKyorLogX3JMp4l0eUAQ+G6NecueTMMrpFEpaXBjMrFDw3zdv1TIU/jvd Itq8OtXxtb1nYN1C1W71T7iNKj/8Rhwc7EfTX8UannMedptHP7Z2TLF5N12D8fxs71 /SaoFKAPwcMSngDdobkGrnJLpguod9K/4mNDPnRE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arnd Bergmann , Douglas Anderson , Daniel Thompson , Sasha Levin Subject: [PATCH 5.4 134/259] kdb: address -Wformat-security warnings Date: Thu, 15 Aug 2024 15:24:27 +0200 Message-ID: <20240815131907.968792116@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240815131902.779125794@linuxfoundation.org> References: <20240815131902.779125794@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann [ Upstream commit 70867efacf4370b6c7cdfc7a5b11300e9ef7de64 ] 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 Fixes: 5d5314d6795f ("kdb: core for kgdb back end (1 of 2)") Reviewed-by: Douglas Anderson Link: https://lore.kernel.org/r/20240528121154.3662553-1-arnd@kernel.org Signed-off-by: Daniel Thompson Signed-off-by: Sasha Levin --- 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 5358e8a8b6f11..9ce4e52532b77 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c @@ -368,7 +368,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); @@ -460,7 +460,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.43.0