Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1583593 > unrolled thread
| Started by | Stephen Boyd <stephen.boyd@linaro.org> |
|---|---|
| First post | 2017-02-17 18:00 +0100 |
| Last post | 2017-02-27 17:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] asm-generic: Force cast get_user() setting x to 0 Stephen Boyd <stephen.boyd@linaro.org> - 2017-02-17 18:00 +0100
Re: [PATCH] asm-generic: Force cast get_user() setting x to 0 Stephen Boyd <stephen.boyd@linaro.org> - 2017-02-25 02:30 +0100
Re: [PATCH] asm-generic: Force cast get_user() setting x to 0 Arnd Bergmann <arnd@arndb.de> - 2017-02-27 17:00 +0100
| From | Stephen Boyd <stephen.boyd@linaro.org> |
|---|---|
| Date | 2017-02-17 18:00 +0100 |
| Subject | [PATCH] asm-generic: Force cast get_user() setting x to 0 |
| Message-ID | <tbU30-6Np-13@gated-at.bofh.it> |
If we call get_user() with an __le* or __be* type sparse will complain when we assign the result to 0 on the faulting path. Let's force cast here so that sparse doesn't complain. This mirrors what we do in __get_user() as well. Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> --- I made a similar fix to arm64 headers, and it looks like asm-generic would need the same fix. include/asm-generic/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index cc6bb319e464..6352d61df7eb 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h @@ -227,7 +227,7 @@ extern int __put_user_bad(void) __attribute__((noreturn)); might_fault(); \ access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ __get_user((x), (__typeof__(*(ptr)) *)__p) : \ - ((x) = (__typeof__(*(ptr)))0,-EFAULT); \ + ((x) = (__force __typeof__(*(ptr)))0, -EFAULT); \ }) #ifndef __get_user_fn -- 2.10.0.297.gf6727b0
[toc] | [next] | [standalone]
| From | Stephen Boyd <stephen.boyd@linaro.org> |
|---|---|
| Date | 2017-02-25 02:30 +0100 |
| Message-ID | <tezlo-mo-5@gated-at.bofh.it> |
| In reply to | #1583593 |
Quoting Stephen Boyd (2017-02-17 08:52:29) > If we call get_user() with an __le* or __be* type sparse will > complain when we assign the result to 0 on the faulting path. > Let's force cast here so that sparse doesn't complain. This > mirrors what we do in __get_user() as well. > > Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> > --- > > I made a similar fix to arm64 headers, and it looks like asm-generic > would need the same fix. I suppose we can ignore this. I was using sparse v0.5.0 but it seems that later versions of sparse don't complain here anymore as Luc has pointed out. -Stephen > > include/asm-generic/uaccess.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h > index cc6bb319e464..6352d61df7eb 100644 > --- a/include/asm-generic/uaccess.h > +++ b/include/asm-generic/uaccess.h > @@ -227,7 +227,7 @@ extern int __put_user_bad(void) __attribute__((noreturn)); > might_fault(); \ > access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ > __get_user((x), (__typeof__(*(ptr)) *)__p) : \ > - ((x) = (__typeof__(*(ptr)))0,-EFAULT); \ > + ((x) = (__force __typeof__(*(ptr)))0, -EFAULT); \ > }) > > #ifndef __get_user_fn
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-02-27 17:00 +0100 |
| Message-ID | <tfvSq-7FO-5@gated-at.bofh.it> |
| In reply to | #1588024 |
On Sat, Feb 25, 2017 at 2:24 AM, Stephen Boyd <stephen.boyd@linaro.org> wrote: > Quoting Stephen Boyd (2017-02-17 08:52:29) >> If we call get_user() with an __le* or __be* type sparse will >> complain when we assign the result to 0 on the faulting path. >> Let's force cast here so that sparse doesn't complain. This >> mirrors what we do in __get_user() as well. >> >> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> >> --- >> >> I made a similar fix to arm64 headers, and it looks like asm-generic >> would need the same fix. > > I suppose we can ignore this. I was using sparse v0.5.0 but it seems > that later versions of sparse don't complain here anymore as Luc has > pointed out. Ok, thanks for the follow-up. Arnd
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web