Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934346AbcLTJv7 (ORCPT ); Tue, 20 Dec 2016 04:51:59 -0500 Received: from forward1h.cmail.yandex.net ([87.250.230.16]:38153 "EHLO forward1h.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932869AbcLTJvz (ORCPT ); Tue, 20 Dec 2016 04:51:55 -0500 Authentication-Results: mxback9j.mail.yandex.net; dkim=pass header.i=@yandex.com.tr From: Ozgur Karatas Envelope-From: mueddib@yandex.com.tr To: Cihangir Akturk Cc: "corbet@lwn.net" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" In-Reply-To: <20161220002226.GB2970@portege.localdomain> References: <1481996537-24721-1-git-send-email-cakturk@gmail.com> <6609661482015132@web29g.yandex.ru> <20161220002226.GB2970@portege.localdomain> Subject: Re: Documentation/unaligned-memory-access.txt: fix incorrect comparison operator MIME-Version: 1.0 Message-Id: <1881701482227511@web3j.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 20 Dec 2016 11:51:51 +0200 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1294 Lines: 29 20.12.2016, 02:22, "Cihangir Akturk" : > On Sun, Dec 18, 2016 at 12:52:12AM +0200, Ozgur Karatas wrote: >>  17.12.2016, 19:43, "Cihangir Akturk" : >>  > In the actual implementation ether_addr_equal function tests for equality to 0 >>  > when returning. It seems in commit 0d74c4 it is somehow overlooked to change >>  > this operator to reflect the actual function. >> >>  why this "return" function need to be ==0? I think, u16 functions read memory but "0" is should not be equalty. > > XOR is true only when inputs differ. That means if inputs are the > same, then it outputs false (0) or whatever you call it. Then we > perform OR operation between those outputs. So if the result is 0 then > addr1 and addr2 is equal. Thanks for this explanation to your patch. In this case the patch mentioned is valid. I checked, turned to "!=0" errors. un-mem.c:29:18: error: ‘!’ (first use in this function) return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; ^ Also, don't need to send patch it secon time :) >>  This way, -for the code to work- memory should be everytime unaligned !=0. > > Sorry I didn't quite get the point. Regards, ~Ozgur