From: christophe lombard <clombard@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4] powerpc: Avoid signed to unsigned conversion in set_thread_tidr()
Date: Tue, 28 Nov 2017 09:26:05 +0100 [thread overview]
Message-ID: <ed9d5ff5-babb-4b84-520e-a9e649eab5e6@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171128025304.30574-1-vaibhav@linux.vnet.ibm.com>
Le 28/11/2017 à 03:53, Vaibhav Jain a écrit :
> There is an unsafe signed to unsigned conversion in set_thread_tidr()
> that may cause an error value to be assigned to SPRN_TIDR register and
> used as thread-id.
>
> The issue happens as assign_thread_tidr() returns an int and
> thread.tidr is an unsigned-long. So a negative error code returned
> from assign_thread_tidr() will fail the error check and gets assigned
> as tidr as a large positive value.
>
> To fix this the patch assigns the return value of assign_thread_tidr()
> to a temporary int and assigns it to thread.tidr iff its '> 0'.
>
> The patch shouldn't impact the calling convention of set_thread_tidr()
> i.e all -ve return-values are error codes and a return value of '0'
> indicates success.
>
> Fixes: ec233ede4c86("powerpc: Add support for setting SPRN_TIDR")
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
>
> ---
sounds good for me
Thanks
Reviewed-by: Christophe Lombard clombard@linux.vnet.ibm.com
next prev parent reply other threads:[~2017-11-28 8:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 2:53 [PATCH v4] powerpc: Avoid signed to unsigned conversion in set_thread_tidr() Vaibhav Jain
2017-11-28 8:26 ` christophe lombard [this message]
2017-11-29 12:06 ` [v4] " 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=ed9d5ff5-babb-4b84-520e-a9e649eab5e6@linux.vnet.ibm.com \
--to=clombard@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.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).