* [PATCH] kasan: remove redundant initialization of variable 'real_size'
@ 2018-02-06 14:49 Colin King
2018-02-06 20:10 ` Andrey Ryabinin
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-02-06 14:49 UTC (permalink / raw)
To: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov, kasan-dev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Variable real_size is initialized with a value that is never read,
it is re-assigned a new value later on, hence the initialization is
redundant and can be removed.
Cleans up clang warning:
lib/test_kasan.c:422:21: warning: Value stored to 'real_size' during
its initialization is never read
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
lib/test_kasan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test_kasan.c b/lib/test_kasan.c
index a808d81b409d..dba0ffd45fd7 100644
--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -419,7 +419,7 @@ static noinline void __init kasan_stack_oob(void)
static noinline void __init ksize_unpoisons_memory(void)
{
char *ptr;
- size_t size = 123, real_size = size;
+ size_t size = 123, real_size;
pr_info("ksize() unpoisons the whole allocated chunk\n");
ptr = kmalloc(size, GFP_KERNEL);
--
2.15.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kasan: remove redundant initialization of variable 'real_size'
2018-02-06 14:49 [PATCH] kasan: remove redundant initialization of variable 'real_size' Colin King
@ 2018-02-06 20:10 ` Andrey Ryabinin
0 siblings, 0 replies; 2+ messages in thread
From: Andrey Ryabinin @ 2018-02-06 20:10 UTC (permalink / raw)
To: Colin King, Alexander Potapenko, Dmitry Vyukov, kasan-dev
Cc: kernel-janitors, linux-kernel, Andrew Morton
On 02/06/2018 05:49 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable real_size is initialized with a value that is never read,
> it is re-assigned a new value later on, hence the initialization is
> redundant and can be removed.
>
> Cleans up clang warning:
> lib/test_kasan.c:422:21: warning: Value stored to 'real_size' during
> its initialization is never read
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
> lib/test_kasan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/test_kasan.c b/lib/test_kasan.c
> index a808d81b409d..dba0ffd45fd7 100644
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -419,7 +419,7 @@ static noinline void __init kasan_stack_oob(void)
> static noinline void __init ksize_unpoisons_memory(void)
> {
> char *ptr;
> - size_t size = 123, real_size = size;
> + size_t size = 123, real_size;
>
> pr_info("ksize() unpoisons the whole allocated chunk\n");
> ptr = kmalloc(size, GFP_KERNEL);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-06 20:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 14:49 [PATCH] kasan: remove redundant initialization of variable 'real_size' Colin King
2018-02-06 20:10 ` Andrey Ryabinin
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 NNTP newsgroup(s).