Re: [PATCH] ksmbd: remove unnecessary conditions

From: Sergey Senozhatsky
Date: Tue Sep 07 2021 - 06:34:47 EST


On (21/09/07 13:17), Dan Carpenter wrote:
> > >
> > > But you've seen it now, right?
> >
> > A linear search in array of 5 elements or a binary search in array of 340
> > elements? Yea, I saw it. I'd prefer one extra uid_valid(), if you'd ask
> > me - why call the function if we already know that it'll fail.
>
> It's a failure path. Hopefully people will only give us valid data.
>

I usually prefer to assume that remote clients are _not exactly_ nice folks.
Can this be a DoS vector - probably not. `cmp; je;` is several thousand
times cheaper that a bsearch, and this is a remote user request servicing
path. So. Just my 5 cents.

I'll leave it to you and Namjae to decide.