linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use clamp_t in UNAME26 fix
@ 2012-10-20  1:45 Kees Cook
  2012-10-20  3:22 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2012-10-20  1:45 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Fengguang Wu, Andrew Morton

The min/max call needed to have explicit types on some architectures
(e.g. mn10300). Use clamp_t instead to avoid the warning.

kernel/sys.c: In function 'override_release':
kernel/sys.c:1287:10: warning: comparison of distinct pointer types lacks a cast [enabled by default]

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 kernel/sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 01865c6..e6e0ece 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1284,7 +1284,7 @@ static int override_release(char __user *release, size_t len)
 			rest++;
 		}
 		v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
-		copy = min(sizeof(buf), max_t(size_t, 1, len));
+		copy = clamp_t(size_t, len, 1, sizeof(buf));
 		copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
 		ret = copy_to_user(release, buf, copy + 1);
 	}
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] use clamp_t in UNAME26 fix
  2012-10-20  1:45 [PATCH] use clamp_t in UNAME26 fix Kees Cook
@ 2012-10-20  3:22 ` Andrew Morton
  2012-10-20  4:30   ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2012-10-20  3:22 UTC (permalink / raw)
  To: Kees Cook; +Cc: Linus Torvalds, linux-kernel, Fengguang Wu

On Fri, 19 Oct 2012 18:45:53 -0700 Kees Cook <keescook@chromium.org> wrote:

> 
> The min/max call needed to have explicit types on some architectures
> (e.g. mn10300). Use clamp_t instead to avoid the warning.
> 
> kernel/sys.c: In function 'override_release':
> kernel/sys.c:1287:10: warning: comparison of distinct pointer types lacks a cast [enabled by default]
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Needs a cc:stable in the changelog before committing, please.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] use clamp_t in UNAME26 fix
  2012-10-20  3:22 ` Andrew Morton
@ 2012-10-20  4:30   ` Kees Cook
  2012-10-24 15:48     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2012-10-20  4:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linus Torvalds, linux-kernel, Fengguang Wu, stable

Argh, whoops. Greg, can you please include
31fd84b95eb211d5db460a1dda85e004800a7b52 in stable?

Thanks,

-Kees

On Fri, Oct 19, 2012 at 8:22 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Fri, 19 Oct 2012 18:45:53 -0700 Kees Cook <keescook@chromium.org> wrote:
>
>>
>> The min/max call needed to have explicit types on some architectures
>> (e.g. mn10300). Use clamp_t instead to avoid the warning.
>>
>> kernel/sys.c: In function 'override_release':
>> kernel/sys.c:1287:10: warning: comparison of distinct pointer types lacks a cast [enabled by default]
>>
>> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>
> Needs a cc:stable in the changelog before committing, please.



-- 
Kees Cook
Chrome OS Security

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] use clamp_t in UNAME26 fix
  2012-10-20  4:30   ` Kees Cook
@ 2012-10-24 15:48     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2012-10-24 15:48 UTC (permalink / raw)
  To: Kees Cook
  Cc: Andrew Morton, Linus Torvalds, linux-kernel, Fengguang Wu, stable

On Fri, Oct 19, 2012 at 09:30:24PM -0700, Kees Cook wrote:
> Argh, whoops. Greg, can you please include
> 31fd84b95eb211d5db460a1dda85e004800a7b52 in stable?

Now applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-24 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-20  1:45 [PATCH] use clamp_t in UNAME26 fix Kees Cook
2012-10-20  3:22 ` Andrew Morton
2012-10-20  4:30   ` Kees Cook
2012-10-24 15:48     ` Greg KH

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).