Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2661969-a0d8-45e1-4334-c9b74d08f143@gmail.com>
Date: Fri, 21 Dec 2018 20:46:48 +0200
From: Igor Stoppa <igor.stoppa@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Andy Lutomirski <luto@...capital.net>,
 Peter Zijlstra <peterz@...radead.org>,
 Dave Hansen <dave.hansen@...ux.intel.com>,
 Mimi Zohar <zohar@...ux.vnet.ibm.com>,
 Thiago Jung Bauermann <bauerman@...ux.ibm.com>, igor.stoppa@...wei.com,
 Nadav Amit <nadav.amit@...il.com>, Kees Cook <keescook@...omium.org>,
 Ahmed Soliman <ahmedsoliman@...a.vt.edu>, linux-integrity@...r.kernel.org,
 kernel-hardening@...ts.openwall.com, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/12] x86_64: memset_user()



On 21/12/2018 20:25, Matthew Wilcox wrote:
> On Fri, Dec 21, 2018 at 08:14:12PM +0200, Igor Stoppa wrote:
>> +unsigned long __memset_user(void __user *addr, int c, unsigned long size)
>> +{
>> +	long __d0;
>> +	unsigned long  pattern = 0;
>> +	int i;
>> +
>> +	for (i = 0; i < 8; i++)
>> +		pattern = (pattern << 8) | (0xFF & c);
> 
> That's inefficient.
> 
> 	pattern = (unsigned char)c;
> 	pattern |= pattern << 8;
> 	pattern |= pattern << 16;
> 	pattern |= pattern << 32;

ok, thank you

--
igor

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.