From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751630AbcBLOqs (ORCPT ); Fri, 12 Feb 2016 09:46:48 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63333 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751189AbcBLOqq (ORCPT ); Fri, 12 Feb 2016 09:46:46 -0500 X-AuditID: cbfec7f4-f79026d00000418a-bf-56bdf05498ce Subject: Re: [PATCH v3] err.h: allow IS_ERR_VALUE to handle properly more types To: Arnd Bergmann References: <20160202163350.f7d42f4b97f48756f3900e9a@linux-foundation.org> <2469004.dGELCApkKV@wuerfel> <56BC31A6.4060102@samsung.com> <3104312.nOVEcCskuj@wuerfel> Cc: Andrew Morton , Bartlomiej Zolnierkiewicz , Marek Szyprowski , open list , Bob Peterson , linux@rasmusvillemoes.dk From: Andrzej Hajda Message-id: <56BDF012.2000503@samsung.com> Date: Fri, 12 Feb 2016 15:45:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 In-reply-to: <3104312.nOVEcCskuj@wuerfel> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsVy+t/xK7ohH/aGGUw9KWAxZ/0aNou/k46x W2ycsZ7V4vKuOWwWj2fNY7NYe+Quu0XX7FY2B3aP378mMXqcmPGbxeNCV7bH+31X2Tz6tqxi 9Pi8SS6ALYrLJiU1J7MstUjfLoErY/bUZ2wFU7kr9izdxtTA+IWji5GTQ0LARGLC7EdMELaY xIV769m6GLk4hASWMko8/buNFcJ5zihx7MobIIeDQ1jAX2LJI1WQBhEBRYmpL54xQ9QsZ5T4 f/gBE4jDLNDAJHFk4QewsWwCmhJ/N99kA7F5BbQkTrW1sYLYLAKqEncunAOrERWIkDjc2cUO USMo8WPyPRYQmxOod93yC+wgi5kF9CTuX9QCCTMLyEtsXvOWeQKjwCwkHbMQqmYhqVrAyLyK UTS1NLmgOCk911CvODG3uDQvXS85P3cTIyTYv+xgXHzM6hCjAAejEg+vwa09YUKsiWXFlbmH GCU4mJVEeA2a9oYJ8aYkVlalFuXHF5XmpBYfYpTmYFES5527632IkEB6YklqdmpqQWoRTJaJ g1OqgdFO/OTHSY49m8MYJ6Z/k608qMtc3vokV3b9Twfm/UfkwhpY25a9PcP6IuuoTsLSSftL TnK92b6gtf1XFJd0mE994rP6rq2/Fi292Oj1+DG3uzx3ieul2YGOsx57eLsY731YtP3bYSfm gKbuM7szN6xyy+7UWS34d/6Km0Fyh4+0/9u0vyPXtVyJpTgj0VCLuag4EQA+gAwKcgIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/11/2016 05:39 PM, Arnd Bergmann wrote: > On Thursday 11 February 2016 08:00:54 Andrzej Hajda wrote: >>> I think the easiest way to express this would be to ensure that the argument >>> is 'unsigned long', like: >>> >>> #define IS_ERR_VALUE(x) ((unsigned long*)NULL == (typeof (x)*)NULL && \ >>> unlikely((unsigned long long)(x) >= (unsigned long long)(typeof(x))-MAX_ERRNO)) >> This way you will limit it only to unsigned long type, which seems too >> strict to me. >> I think the macro should accept all long enough unsigned types, otherwise we >> could end up with bunch of macros IS_ERR_VALUE_U32, IS_ERR_VALUE_ULL... > I think in practice we only care about 'int' and 'unsigned long', which are > the ones that 90% of the existing users pass in today. u32 has never worked > on 64-bit architectures so far, so we don't necessarily have to make it work. > As Al mentioned, most users of IS_ERR_VALUE are wrong anyway and should > just use 'if (err < 0)' or 'if (err)'. > > We could also consider making just 'int' and 'unsigned long' allowed types > for the moment, and then change all users passing 'int' before forbidding them. > > Arnd > > OK so in short we need to fix 140 usages of the macro? Who should do them? I can create cocci patch for more obvious cases. What about these less obvious? As I understand we do not touch the macro till fixes are merged? Regards Andrzej