linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens.net>
To: Colin King <colin.king@canonical.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null
Date: Mon, 12 Oct 2015 11:35:20 +1100	[thread overview]
Message-ID: <878u7853g7.fsf@gamma.ozlabs.ibm.com> (raw)
In-Reply-To: <1444330858-5508-1-git-send-email-colin.king@canonical.com>

[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]


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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 859 bytes --]

  reply	other threads:[~2015-10-12  0:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 19:00 [PATCH] powerpc/pseries/hvcserver: don't memset pi_buff if it is null Colin King
2015-10-12  0:35 ` Daniel Axtens [this message]
2015-10-12  6:14   ` Colin Ian King
2015-10-12 11:21 ` Michael Ellerman

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=878u7853g7.fsf@gamma.ozlabs.ibm.com \
    --to=dja@axtens.net \
    --cc=benh@kernel.crashing.org \
    --cc=colin.king@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.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 NNTP newsgroup(s).