Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp482675imm; Thu, 26 Jul 2018 07:02:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpePuf3Sf8xpTb33UE/hhyjHEbXT1lw+8p+JV7l37oE1D2ACrNsOoyVsqXsn93wMtB1q8WNs X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr2095920plb.198.1532613751788; Thu, 26 Jul 2018 07:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532613751; cv=none; d=google.com; s=arc-20160816; b=poQLcJDgqxmJ5JmYRHtyK6gSeJTfVRMo1hucUsr3a1OPesJdsHdLa4M/Gbsr3Vz+GH r/g4Ht/Zly3mGVu3dUPqGHjnOw4rdlqexcuY+Rmb2VorVWKc1opRC0TvVYdZRlfhz4Tl /6+iRIY5W8qWAnhOigNh75rX8AMo0Vmd0S9kZHHAnebO7NYOihvm9JWYWQ7xAb7dnolJ dnfUoAjr6CrFQRgDg3Dp5CDhemJ+/ujeXCIzcMmw0HERH1QtkrJBbrUDak6FZd7Kb7i3 3mo7noCgJGs5/KEhjcz+Ycb0JyMJMtZr5w6uhDy5S8e7O4EVgyvFKeT0QSvoIZmnwmiq Lm8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=aoyaBYLdAR7G9qZi8MO/Kt3UvWlbOBA9anEPmOfH9A4=; b=QD3LZ2s5FXLP6LPpI1fWTiPkKrFkudUklfPhXfog99JHFyfcpQA3HP/tH8tz3YVn56 54uLslbUgaeHsCJKXuBe3j6h+OZm171WaYu4ZLRC/IX5ssOriwLGSAVt8jyvQhf902i5 XsXkGiqsy5k/iZeltU/qVIzcQNl3RF3uYTZpMMyGytmpSAFGP+J6n7+p0DLogYRZzPTu qD1j8USzC9SJ72ATO5K+mybL1bStwb/I1j9UVra+8UiIa909NnUvs6SWG95/k3Qy6DGR Sb1DLGcoVtF/l9dKyuCTyyXifgHu5EICBY04Og01NDWpkJ34S48MWJj3eoVl6PD4W2Nh qVGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bYGiB24b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6-v6si1314656pgz.592.2018.07.26.07.02.16; Thu, 26 Jul 2018 07:02:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bYGiB24b; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730641AbeGZPRk (ORCPT + 99 others); Thu, 26 Jul 2018 11:17:40 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:40323 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729406AbeGZPRk (ORCPT ); Thu, 26 Jul 2018 11:17:40 -0400 Received: by mail-ua0-f195.google.com with SMTP id p22-v6so1131863uao.7 for ; Thu, 26 Jul 2018 07:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aoyaBYLdAR7G9qZi8MO/Kt3UvWlbOBA9anEPmOfH9A4=; b=bYGiB24buxTzSZNLFONeN5I7j/BYsY6hebTiv0Voj/lWM0Mfv4q9PsTX2Cg/50Qt+/ tFsFcDPGtAY7j5I4StlsqNjR6nHiezQ7MyZlWhCoJkyNRSeJO2lGaMVT2wmfeE/Djzxl GSbXLdH/GqRYPLq5ZTcdvV/ea1vOPz957le33CFx+BCzJ3hZtnk/EdxLut/+3GTLESUb QeyDoCzAn6hIuB1/GMbsUkRYXjRYVan6I6Op0v0TPRykyQ9Y6237s0Ng79SyWwomkbL6 nvl98s17ZPGif2lSRaxNBGE52E8H8RP4OgTTZArKGcpTbq6sYEC+ssQR7gO4Mz2ztzxn Srkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aoyaBYLdAR7G9qZi8MO/Kt3UvWlbOBA9anEPmOfH9A4=; b=aFUR61HuIfhizfe3xLRntM1bXZZ7dKu0xnEgLWrfVXJB5inLBNwapKTOjwhPJ4gE+j z2Imi01YwZiKuIu8uVAnqjNzZCMKwuCYC/fvFoeUlaVSGGu9LxgkOpE8QRS51Lx8R4Jw wARocQSGJME9j/WIaC/J1DKsEos1xllEoWPNN7ZKarrFXnhY5+uaJvySutuaL8F79US3 A1G0njb2gtH8I/Tp0cDdivDXMTaWjYyfwfCyaCm5LNM090EaMK5M0AybKWDckKKFbrd4 +W56F3HT/J+ydUwJ1iPnc1YsDzcIVFbvupYTI/lHRcX81X1n0OI9qRq3VBqpV326OiLN SUmw== X-Gm-Message-State: AOUpUlHiPQ5K2/HDllyvHz7m9pCJabUM8V3uc5+GSqSuY67meiNdpX8f k1kk0MIWWp2S3ZUUiAIA1FQjNcBGfhqMFXQucPw= X-Received: by 2002:ab0:70a9:: with SMTP id q9-v6mr1382939ual.141.1532613639695; Thu, 26 Jul 2018 07:00:39 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:2149:0:0:0:0:0 with HTTP; Thu, 26 Jul 2018 07:00:39 -0700 (PDT) In-Reply-To: <5B599DB7.4050700@intel.com> References: <1532592471-21177-1-git-send-email-wei.w.wang@intel.com> <5B599DB7.4050700@intel.com> From: Andy Shevchenko Date: Thu, 26 Jul 2018 17:00:39 +0300 Message-ID: Subject: Re: [PATCH] linux/bitmap.h: fix BITMAP_LAST_WORD_MASK To: Wei Wang Cc: Linux Kernel Mailing List , Andrew Morton , Yury Norov , Jonathan Corbet , Rasmus Villemoes , dgilbert@redhat.com, Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 26, 2018 at 1:08 PM, Wei Wang wrote: > On 07/26/2018 04:48 PM, Andy Shevchenko wrote: >> >> On Thu, Jul 26, 2018 at 11:07 AM, Wei Wang wrote: >>> >>> The existing BITMAP_LAST_WORD_MASK macro returns 0xffffffff if nbits is >>> 0. This patch changes the macro to return 0 when there is no bit needs to >>> be masked. >>> >> Can you provide a practical example of what's going wrong before this >> patch applied? >> > > The reason of making this patch is that I saw some other software which > ports this function and has possibilities to fall into bugs with usages > which pass 0 to the macro. No problems in the kernel, right? > So I wonder if it would be necessary to make such > changes in case we would get a similar bug. Or adding something to explain > that "0" is not applicable to this macro as a reminder to people who would > use it. Comment can be added, yes. -- With Best Regards, Andy Shevchenko