Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1242692 > unrolled thread

[PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null

Started byColin King <colin.king@canonical.com>
First post2015-10-08 21:10 +0200
Last post2015-10-12 13:30 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null Colin King <colin.king@canonical.com> - 2015-10-08 21:10 +0200
    Re: [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null Daniel Axtens <dja@axtens.net> - 2015-10-12 02:40 +0200
      Re: [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is  null Colin Ian King <colin.king@canonical.com> - 2015-10-12 08:20 +0200
    Re: powerpc/pseries/hvcserver: don't memset pi_buff if it is null Michael Ellerman <mpe@ellerman.id.au> - 2015-10-12 13:30 +0200

#1242692 — [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null

FromColin King <colin.king@canonical.com>
Date2015-10-08 21:10 +0200
Subject[PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null
Message-ID<qhoJH-41D-11@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

pi_buff is being memset before it is sanity checked. Move the
memset after the null pi_buff sanity check to avoid an oops.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 arch/powerpc/platforms/pseries/hvcserver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerpc/platforms/pseries/hvcserver.c
index eedb645..94a6e56 100644
--- a/arch/powerpc/platforms/pseries/hvcserver.c
+++ b/arch/powerpc/platforms/pseries/hvcserver.c
@@ -142,11 +142,11 @@ int hvcs_get_partner_info(uint32_t unit_address, struct list_head *head,
 	int more = 1;
 	int retval;
 
-	memset(pi_buff, 0x00, PAGE_SIZE);
 	/* invalid parameters */
 	if (!head || !pi_buff)
 		return -EINVAL;
 
+	memset(pi_buff, 0x00, PAGE_SIZE);
 	last_p_partition_ID = last_p_unit_address = ~0UL;
 	INIT_LIST_HEAD(head);
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1244316

FromDaniel Axtens <dja@axtens.net>
Date2015-10-12 02:40 +0200
Message-ID<qizjI-7Uc-9@gated-at.bofh.it>
In reply to#1242692

[Multipart message — attachments visible in raw view] — view raw

Hi Colin,

This looks good. Out of curiousity, how did you find it? Code
inspection? Bug? Static analysis?

Not that it's particularly meaningful for such a trivial fix, but FWIW:

Reviewed-by: Daniel Axtens <dja@axtens.net>

Regards,
Daniel

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> pi_buff is being memset before it is sanity checked. Move the
> memset after the null pi_buff sanity check to avoid an oops.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  arch/powerpc/platforms/pseries/hvcserver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerpc/platforms/pseries/hvcserver.c
> index eedb645..94a6e56 100644
> --- a/arch/powerpc/platforms/pseries/hvcserver.c
> +++ b/arch/powerpc/platforms/pseries/hvcserver.c
> @@ -142,11 +142,11 @@ int hvcs_get_partner_info(uint32_t unit_address, struct list_head *head,
>  	int more = 1;
>  	int retval;
>  
> -	memset(pi_buff, 0x00, PAGE_SIZE);
>  	/* invalid parameters */
>  	if (!head || !pi_buff)
>  		return -EINVAL;
>  
> +	memset(pi_buff, 0x00, PAGE_SIZE);
>  	last_p_partition_ID = last_p_unit_address = ~0UL;
>  	INIT_LIST_HEAD(head);
>  
> -- 
> 2.5.0
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

[toc] | [prev] | [next] | [standalone]


#1244404 — Re: [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null

FromColin Ian King <colin.king@canonical.com>
Date2015-10-12 08:20 +0200
SubjectRe: [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null
Message-ID<qiECK-7jp-1@gated-at.bofh.it>
In reply to#1244316
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 12/10/15 01:35, Daniel Axtens wrote:
> 
> Hi Colin,
> 
> This looks good. Out of curiousity, how did you find it? Code
> inspection? Bug? Static analysis?

static analysis with cppcheck. I forgot to mention that in the commit
message.

> 
> Not that it's particularly meaningful for such a trivial fix, but FWIW
:
> 
> Reviewed-by: Daniel Axtens <dja@axtens.net>
> 
> Regards,
> Daniel
> 
> Colin King <colin.king@canonical.com> writes:
> 
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> pi_buff is being memset before it is sanity checked. Move the
>> memset after the null pi_buff sanity check to avoid an oops.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  arch/powerpc/platforms/pseries/hvcserver.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerp
c/platforms/pseries/hvcserver.c
>> index eedb645..94a6e56 100644
>> --- a/arch/powerpc/platforms/pseries/hvcserver.c
>> +++ b/arch/powerpc/platforms/pseries/hvcserver.c
>> @@ -142,11 +142,11 @@ int hvcs_get_partner_info(uint32_t unit_address
, struct list_head *head,
>>  	int more = 1;
>>  	int retval;
>>  
>> -	memset(pi_buff, 0x00, PAGE_SIZE);
>>  	/* invalid parameters */
>>  	if (!head || !pi_buff)
>>  		return -EINVAL;
>>  
>> +	memset(pi_buff, 0x00, PAGE_SIZE);
>>  	last_p_partition_ID = last_p_unit_address = ~0UL;
>>  	INIT_LIST_HEAD(head);
>>  
>> -- 
>> 2.5.0
>>
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWG0/KAAoJEGjCh9/GqAImcV8QAIToDexS4X/vya3F8aHZ2qtT
idFEvgKl1mJxzgk79RJs874AiGs3CtOEC3/5w5fMh4eA/P6d6vJ1NPDu5bsugzzA
I6F329WP/QxeOWgU13GSXxa0p13sUxTXqFRT8sHqwDgEaecX6kR+nf8x+P5pZUYX
c7y25IHCZ/nNrj/QwQZcrlNd+U5bwxHyd5zUPJYYInbSEQmPUrhFhW1EkiUDVEYG
6rGmCzRGqfPS2sBqLXG/6ObP4FO8NC+bxQxNWAG/p9iWZg9KdIVL7IFTjWbxT7GC
dsVbBsWu7ewUqo6euK56cd5CFf0oFDoHwhbDQ7T9b9CHYvGVWHxW1k7rUCgcep9x
yJIIWOAVw78DemV3JkZm53Q2+1jUCYuaY6Vw8M3UmdQbWrg2rvbh8TtgoCiXbbrF
HlNO0wlFOBpmr7LoHEPoIV8TsIeoeEikGrXszkqXI/MXKvN8jW1k5vtzcD3j+EU9
gy9wZvovvVZ6RL0erXwVLdzDp+R2clQfIcSi/St2/OGW+5X9NXtuaa+mvBy+dcpW
Se0kO8DpLmHfNtcXvXJhCm77O1Oapw7s5UumevXSTibZ/Mhxzrdg+YhSWexm/SRu
evcm6pagTpX3Vruq4BTt0Rdji9J/stT8GFlOWT0hGH1ZBLrzIKTlkJskSTkT801N
+MkiI6UyL8lqdVoqZrNk
=xqJ4
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1244602 — Re: powerpc/pseries/hvcserver: don't memset pi_buff if it is null

FromMichael Ellerman <mpe@ellerman.id.au>
Date2015-10-12 13:30 +0200
SubjectRe: powerpc/pseries/hvcserver: don't memset pi_buff if it is null
Message-ID<qiJsK-5Ti-13@gated-at.bofh.it>
In reply to#1242692
On Thu, 2015-08-10 at 19:00:58 UTC, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> pi_buff is being memset before it is sanity checked. Move the
> memset after the null pi_buff sanity check to avoid an oops.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c13e1c05b22b504bf0d72fc7

cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web