Linux Kernel Mentees Archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: angquan yu <angquan21@gmail.com>
Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests:breakpoints: Fix Format String Warning in breakpoint_test
Date: Thu, 30 Nov 2023 14:36:10 -0700	[thread overview]
Message-ID: <89e0378d-f03d-42ef-9495-ada312dd5139@linuxfoundation.org> (raw)
In-Reply-To: <20231129035726.6273-1-angquan21@gmail.com>

On 11/28/23 20:57, angquan yu wrote:
> From: angquan yu <angquan21@gmail.com>
> 
> 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 <angquan21@gmail.com>

Thank you foe the fix. Applied to linux-kselftest next Linux 6.8-rc1

thanks,
-- Shuah


      reply	other threads:[~2023-11-30 21:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29  3:57 [PATCH] selftests:breakpoints: Fix Format String Warning in breakpoint_test angquan yu
2023-11-30 21:36 ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89e0378d-f03d-42ef-9495-ada312dd5139@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=angquan21@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).