lkml.org 
[lkml]   [2008]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] globmatch() helper function
From
Date

On Wed, 2008-12-17 at 17:51 +0100, Andi Kleen wrote:
> > OK, lets compromise with WARN_ON_ONCE() ;-)
>
> I don't think WARN_ON is the right way to handle bad user input.
> It implies that when someone typos the result might end up in Arjan's
> kerneloops.org database, which is not good.


Since I recommended an internal helper function, we could have:

int globmatch(const char *pat, const char *str)
{
int ret;

ret = globmatch_internal(pat, str, 0);
if (ret < 0)
WARN_ON();
return ret;
}

int globmatch_user(const char *pat, const char *str)
{
return globmatch_internal(pat, str, 0);
}


This would warn on if a kernel user caused the overflow, and also gives
a function that user space input could use, that would not warn on
overflow.

-- Steve




\
 
 \ /
  Last update: 2008-12-17 17:57    [W:0.052 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site