[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c03227b3-1c79-d214-5880-19f2f1ea0491@arm.com>
Date: Thu, 29 Nov 2018 16:49:18 +0000
From: Dave Rodgman <dave.rodgman@....com>
To: "dsterba@...e.cz" <dsterba@...e.cz>, Yueyi Li <liyueyi@...e.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"w@....eu" <w@....eu>,
"donb@...uritymouse.com" <donb@...uritymouse.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"markus@...rhumer.com" <markus@...rhumer.com>
CC: nd <nd@....com>
Subject: Re: [PATCH v2] lzo: fix ip overrun during compress.
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
Powered by blists - more mailing lists