Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5996504rwi; Sun, 23 Oct 2022 16:13:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NxUhy4A0Pk+deNGD5XP+U36feCBU1+MXLcay3/E8x8GAn95BiOAKcO8fqXUqQNdk6xpaU X-Received: by 2002:a17:907:c15:b0:78d:9c3c:fb8f with SMTP id ga21-20020a1709070c1500b0078d9c3cfb8fmr25945504ejc.347.1666566780038; Sun, 23 Oct 2022 16:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666566780; cv=none; d=google.com; s=arc-20160816; b=d0vAKnT2Ow+trY7An8fkxskyhTY8PRXzwk3dcyaSGfLGS8feu9FAGIxTfyQsq4INSd HfDUywVW87JaP5YFQWZD/xLdSGRVHDRVF7kSwSzLAxRuHGx5605T2PMmYKvqbIdaI8ss Evo3ltFeJsM/HlejV6CXVACpa41Qb80QyXl3h55H4mfW3vQUnt+efJzaZeQ+zd5lbmHX tQond0Ltjrqq1TzgxpCA5kYt+G9uHq4nkvvikxXbeH9M5wiVyw4NdHO5tCpCbBbqtk7e cTSklY+bfMg1HUiF1ucszTreEjm6ISqgd6XmXt80ejib3PF1p2E4YAwxlz7Cs/TVogGg +GBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tDuYPbSy2ARF9msXVJhQW+HurxcpnbQPUhbr2uLzj9g=; b=xyO5ttJJqfoUEp9Ga2AkAQlJEKJSIn/lNUhV1H4A4KisFDIaj6dr1514So1Fj2LcV6 u/B3G5bA62+EH/+NZCDo8NTGz7/V304J4R90LLsVu4ic5L246NlLwRJ6oXfm7efARIde oQo9SDIklTjQpVTLi/sIxPsUgfnFLoYz0UdkullSb9/QywJUA28IXs45fKgTuIbN4MJT Eqn2upEG4NmaoDvi1TCj9TuuoxVNGpMoH+jrfcNtLMDZ7E0aig5w117Hs4HCfNLyUCWa 2HOaxGlaBLZTJbfTNLoxGPZ/QMvT9KHIBHD1bqz7qVBmWj6LVFgwVznWRYFClQlu7wuR XTjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hvYqLXNx; 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 u15-20020a056402064f00b0045c0de4b0e9si22755697edx.170.2022.10.23.16.12.18; Sun, 23 Oct 2022 16:13:00 -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=@linux-foundation.org header.s=google header.b=hvYqLXNx; 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 S229634AbiJWWTs (ORCPT + 99 others); Sun, 23 Oct 2022 18:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbiJWWTo (ORCPT ); Sun, 23 Oct 2022 18:19:44 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0654A28737 for ; Sun, 23 Oct 2022 15:19:43 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id m6so5210818qkm.4 for ; Sun, 23 Oct 2022 15:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tDuYPbSy2ARF9msXVJhQW+HurxcpnbQPUhbr2uLzj9g=; b=hvYqLXNxgcfZg/6dTWAaKpb++Wa9cAbgx15nMK3Y8ykx3enV1c7f9jkzOAIw1EP142 UrhDtdN7Wro5kh+a4v0/Lje8Cki6pBlWRN+0qEQ+9+nk5NYY/oUK1HxeUJhbDhD+vUSO NjmHvDYKhwFLB++TeJrrbE9rDnApMJcDOeS7Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tDuYPbSy2ARF9msXVJhQW+HurxcpnbQPUhbr2uLzj9g=; b=AsfCsI6rNOdLAmZs8wIJuouLFTYpVo0k6/aYoAZ2jCyVnTR8wLFkF1ZucpgQwUjV2h yusH9Sw4qxdNcBJs9qsveMgEIT5naJc16yc3Ut4L4ShBm3IiKgweVC/VqkHeXxXF1GX4 fQOsuBH5BTmRZwTgGtyov7M2oYsYYYJlnTyzNjDRpXErEUjVCcbXIaS6chzMofA0I/OE 3o7UDQxKwsFIyKbEq3tGWPZlGzyO+o/9fvtUDo3d4bc2hdEZW5+l2y3PQwYhpB4wt017 CMNao4GWARVKCRNwGx6Tl+WTdL6QFLY8Te0IP6AjDOkjwII79vcYmanejbmXuNZA1tMJ kn0g== X-Gm-Message-State: ACrzQf3QF134o/lYP0ZuxnFsTY8pkP8YrWCnHd1eTdP6LypJWouj647d CSiKhkIH1hBqaNus73bvVcbh4wdpiVuCDQ== X-Received: by 2002:a05:620a:458e:b0:6ee:cd9a:212c with SMTP id bp14-20020a05620a458e00b006eecd9a212cmr20961965qkb.775.1666563581919; Sun, 23 Oct 2022 15:19:41 -0700 (PDT) Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com. [209.85.128.178]) by smtp.gmail.com with ESMTPSA id hh6-20020a05622a618600b00343057845f7sm11528804qtb.20.2022.10.23.15.19.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 23 Oct 2022 15:19:41 -0700 (PDT) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-35befab86a4so71462597b3.8 for ; Sun, 23 Oct 2022 15:19:40 -0700 (PDT) X-Received: by 2002:a81:114e:0:b0:36a:fc80:fa62 with SMTP id 75-20020a81114e000000b0036afc80fa62mr8493776ywr.58.1666563580499; Sun, 23 Oct 2022 15:19:40 -0700 (PDT) MIME-Version: 1.0 References: <20221020032024.1804535-1-yury.norov@gmail.com> <20221020032024.1804535-2-yury.norov@gmail.com> In-Reply-To: <20221020032024.1804535-2-yury.norov@gmail.com> From: Linus Torvalds Date: Sun, 23 Oct 2022 15:19:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] bitmap: add sanity check function for find_bit() To: Yury Norov Cc: "Russell King (Oracle)" , Catalin Marinas , Mark Rutland , Will Deacon , linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List , Alexey Klimov , Andy Shevchenko , Andy Whitcroft , Dennis Zhou , Geert Uytterhoeven , Guenter Roeck , Kees Cook , Rasmus Villemoes Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Wed, Oct 19, 2022 at 8:24 PM Yury Norov wrote: > > This patch adds runtime check for the pointers to be aligned. No. Don't add pointless things like this. It only adds code, with no advantage. The bitmap ops all operate on 'unsigned long', and if a bitmap isn't aligned, we'll take a fault on the architectures that don't do unaligned accesses natively. And the find-bit functions simply aren't special enough to have this kind of random testing, when the *basic* bitmap functions like "set_bit()" and friends all do the accesses without any alignment checks. The fact that filesystem code often uses bitmap functions with a cast from 'char *' is immaterial. Those things are already aligned (typically they are a whole disk block). They just weren't an array of 'unsigned long'. Linus