From: Joe Perches <joe@perches.com>
To: Zheng Yongjun <zhengyongjun3@huawei.com>,
keescook@chromium.org, arnd@arndb.de, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH] lkdtm: Remove set but not used variable 'byte'
Date: Sun, 10 Nov 2019 10:13:50 -0800 [thread overview]
Message-ID: <61e165241e4b98cd655ac79cd110f3f08e389838.camel@perches.com> (raw)
In-Reply-To: <20191110092249.182210-1-zhengyongjun3@huawei.com>
On Sun, 2019-11-10 at 17:22 +0800, Zheng Yongjun wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/misc/lkdtm/bugs.c: In function lkdtm_STACK_GUARD_PAGE_LEADING:
> drivers/misc/lkdtm/bugs.c:236:25: warning: variable byte set but not used [-Wunused-but-set-variable]
> drivers/misc/lkdtm/bugs.c: In function lkdtm_STACK_GUARD_PAGE_TRAILING:
> drivers/misc/lkdtm/bugs.c:250:25: warning: variable byte set but not used [-Wunused-but-set-variable]
>
> byte is never used, so remove it.
I believe "hulk robot" needs to be updated instead.
It seems a generically bad idea to elide as byte
is in fact used because it's volatile and the
compiler was forced to perform the access of *ptr.
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
> drivers/misc/lkdtm/bugs.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
> index 7284a22b1a09..fcd943725b66 100644
> --- a/drivers/misc/lkdtm/bugs.c
> +++ b/drivers/misc/lkdtm/bugs.c
> @@ -249,12 +249,9 @@ void lkdtm_STACK_GUARD_PAGE_LEADING(void)
> {
> const unsigned char *stack = task_stack_page(current);
> const unsigned char *ptr = stack - 1;
> - volatile unsigned char byte;
>
> pr_info("attempting bad read from page below current stack\n");
>
> - byte = *ptr;
> -
> pr_err("FAIL: accessed page before stack!\n");
> }
>
> @@ -263,12 +260,9 @@ void lkdtm_STACK_GUARD_PAGE_TRAILING(void)
> {
> const unsigned char *stack = task_stack_page(current);
> const unsigned char *ptr = stack + THREAD_SIZE;
> - volatile unsigned char byte;
>
> pr_info("attempting bad read from page above current stack\n");
>
> - byte = *ptr;
> -
> pr_err("FAIL: accessed page after stack!\n");
> }
>
next prev parent reply other threads:[~2019-11-10 18:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-10 9:22 Zheng Yongjun
2019-11-10 18:13 ` Joe Perches [this message]
2019-11-10 18:18 ` Greg KH
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=61e165241e4b98cd655ac79cd110f3f08e389838.camel@perches.com \
--to=joe@perches.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=hulkci@huawei.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhengyongjun3@huawei.com \
/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
all inboxes | Powered by JetHome®