Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5876106rwb; Tue, 9 Aug 2022 05:42:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7BC9+OWe4GTPPQM4ok2tH+qAw65sxNDwhlYLoBZt3xs/nHJHO8tq6cC2iHyDw2kSaKEquR X-Received: by 2002:a17:907:2e19:b0:730:acf0:4924 with SMTP id ig25-20020a1709072e1900b00730acf04924mr16438784ejc.629.1660048973968; Tue, 09 Aug 2022 05:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660048973; cv=none; d=google.com; s=arc-20160816; b=EIN7XjQ7SVnjE5yRlhJvSU1g6XkAtVOSIsggbjGPotpyeeqFEuxXxgs9lujFGq4Sws +BO4spzgeDm8z8lA7GAb1i1w62aCinFxGMU6bz6E8sVY+LG5gJf5Ow7Q253q/UbLAUZA dkrHgtVJvnQY8hwoNOwqqe05GSfaERshi2idKGRb+Np9wX2aUl70Sv/m2r53fsBUFu1k JY6gNh3ZpqBboNdEcZchXntl/lB5/OXzf969gnpFLGM+uCMWKMZrhibcdBLf07SZ8lOm fRnw7OmFRcB8vEXFq1e46Zxzu2PvD5GVn53Fy2CxsIop71aUmo+Xvb/UjncD27XLT1be y5mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=S/vY+pHOAJw8ND8t13oTQazIac4o9LGilFJcZDyaByQ=; b=FUXVzkustIEjS84wEkalBb+a2tbM64F5F52sJgT0qTo7RNElFFOrRgZHpXlk42Bzqa mtuZPdb3tY4WcMKin+x6F83FUsQjwjxOLIi5Me022j//Aa+wde91U1/duyKddeIolt3Y 01DDxkY8VkhtbzMAbN6tXb8/Kuhuw0CoSOug0kC2Hl8Op7UhAkhkRJeT32IGn2ObVEDt zLdgSG3/s/FIkQ51FEpGvptKrTPpmTnqEtecrPw0oBOUMqxwp8KKWaVnpQlnKmZrzDkU M2D3UoawWahPqE3pmzugJUp1sJTp53KKsc/EVcmq7mwCMub/8wQyQy52LGul7kmfgMup PmJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Mrb2Al4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r15-20020a1709062ccf00b00730a07ef039si1776551ejr.423.2022.08.09.05.42.27; Tue, 09 Aug 2022 05:42:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Mrb2Al4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239452AbiHIMhd (ORCPT + 99 others); Tue, 9 Aug 2022 08:37:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241027AbiHIMhb (ORCPT ); Tue, 9 Aug 2022 08:37:31 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 911BD17A8B for ; Tue, 9 Aug 2022 05:37:29 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id bx38so12813026ljb.10 for ; Tue, 09 Aug 2022 05:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=S/vY+pHOAJw8ND8t13oTQazIac4o9LGilFJcZDyaByQ=; b=Mrb2Al4kVt5O3KiUdyGMMX9sVayGDb/FyFERwnGXD0vImjgWnB9fEsdatVsTaDfecG tvBp1u1TXVZ3p9+RiYyop/1CWPisZcwCgR9LRfnwCJTDts+eeXMqzsNrHTfIXOK8bsxg 7oIhTFZA3U3EMwPCbiMwRNLvtfZtB21DPskCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=S/vY+pHOAJw8ND8t13oTQazIac4o9LGilFJcZDyaByQ=; b=1Gf/R7g9sMtcUmMz5pKzDAPsvkSUAPYAiKkqELmRmL3a/gvJoyn/GImaH9+GqoujIa e1dP2oTEV1H3D+Ae1t9DDU+oHgngjjtkOLe/yLOEZ79NHaJPAPSBvonfEc+U9CFjBZKw wQ9eFU8pTmEo77mYu5lDlwJyG2DdKD5l0Byx2Mhhm2xftvRjvVowZ8uizXkE1QuMzrZt qKgv3DBWpbpP6A09JRTWpvoGpUmpDXY01h+5ZvGVughWTkihxyvFYmG2moHDSxCqv1pU imR93HxDUrcDo2ahhFmrkor4DKDIMXIvDhOP+9xmwkhXDrKZhUD6YMNBr6lhYgQODVcA drow== X-Gm-Message-State: ACgBeo1CyGLIBmUzMbjWR2Yp/w3FN25kRSj1jQYWbiB9z66Gz3VWn2oG 2lFUmUP73HGsQ+OgtwGz7YNLaw== X-Received: by 2002:a05:651c:222:b0:25e:4ae2:c5ae with SMTP id z2-20020a05651c022200b0025e4ae2c5aemr7207953ljn.440.1660048647869; Tue, 09 Aug 2022 05:37:27 -0700 (PDT) Received: from [172.16.11.74] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id c6-20020a056512324600b0048b2245519asm1753471lfr.192.2022.08.09.05.37.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Aug 2022 05:37:25 -0700 (PDT) Message-ID: <36677eab-6407-afd1-4cbf-a90be9554c8b@rasmusvillemoes.dk> Date: Tue, 9 Aug 2022 14:37:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 03/16] lib/test_bitmap: don't test bitmap_set if nbits == 0 Content-Language: en-US To: Yury Norov , linux-kernel@vger.kernel.org, Alexander Lobakin , Alexei Starovoitov , Alexey Klimov , Andrew Morton , Andrii Nakryiko , Andy Shevchenko , Ben Segall , Christoph Lameter , Dan Williams , Daniel Borkmann , Daniel Bristot de Oliveira , Dennis Zhou , Dietmar Eggemann , Eric Dumazet , Frederic Weisbecker , Guenter Roeck , Ingo Molnar , Isabella Basso , John Fastabend , Josh Poimboeuf , Juergen Gross , Juri Lelli , KP Singh , Kees Cook , Martin KaFai Lau , Mel Gorman , Miroslav Benes , Nathan Chancellor , "Paul E . McKenney" , Peter Zijlstra , Randy Dunlap , Sebastian Andrzej Siewior , Song Liu , Steven Rostedt , Tejun Heo , Thomas Gleixner , Valentin Schneider , Vincent Guittot , Vlastimil Babka , Yonghong Song , linux-mm@kvack.org, netdev@vger.kernel.org, bpf@vger.kernel.org References: <20220718192844.1805158-1-yury.norov@gmail.com> <20220718192844.1805158-4-yury.norov@gmail.com> From: Rasmus Villemoes In-Reply-To: <20220718192844.1805158-4-yury.norov@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/07/2022 21.28, Yury Norov wrote: > Don't test bitmap_set(bitmap, start, 0) as it's useless, most probably > a sign of error in real code, No it's not. The nbits can easily be the result of some computation that ended up resulting in 0 being the right number to copy (or set, or whatnot), and it's not unreasonable to _not_ check in the caller for that special case, but rather rely on bitmap_set() to behave sanely - it has perfectly well-defined semantics to "set 0 bits starting at @start". The same way that memset() and memcpy() and memcmp() and countless other functions have perfectly well-defined semantics with a length of 0, and we don't add caller-side checks for those either. NAK on this series. Rasmus