lkml.org 
[lkml]   [2018]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] lzo: fix ip overrun during compress.
Date
On 28/11/2018 1:52 pm, David Sterba wrote:

> The fix is adding a few branches to code that's supposed to be as fast
> as possible. The branches would be evaluated all the time while
> protecting against one signle bad page address. This does not look like
> a good performance tradeoff.

As an alternative, for all but the first case, instead of:

if (unlikely(OVERFLOW_ADD_CHECK(ip, m_len) || (ip + m_len >= ip_end)))

I'd suggest we do:

if (unlikely((ip_end - ip) <= m_len))

which will be about as efficient as what's currently there, but doesn't
have issues with overflow.

Dave
\
 
 \ /
  Last update: 2018-11-29 17:49    [W:0.092 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site