lkml.org 
[lkml]   [2019]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] staging: erofs: keep corrupted fs from crashing kernel in erofs_namei()
On Fri, Feb 15, 2019 at 03:02:25PM +0800, Chao Yu wrote:
> On 2019/2/1 20:16, Gao Xiang wrote:
> > + /*
> > + * on-disk error, let's only BUG_ON in the debugging mode.
> > + * otherwise, it will return 1 to just skip the invalid name
> > + * and go on (in consideration of the lookup performance).
> > + */
> > + DBG_BUGON(qd->name > qd->end);
>
> qd->name == qd->end is not allowed as well?
>
> So will it be better to return directly here?
>
> if (unlikely(qd->name >= qd->end)) {
> DBG_BUGON(1);
> return 1;
> }

Please don't add likely/unlikely() annotations unless you have
benchmarked it and it makes a difference.

regards,
dan carpenter


\
 
 \ /
  Last update: 2019-02-15 08:59    [W:0.096 / U:7.788 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site