Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp67777rdb; Mon, 18 Sep 2023 08:25:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHacJVoDeaPYfrWEaAISgmPvZCOJ5fY1cj88NkPv9YOJjvrOA3wVGHim5jw4Y1yaFagPv+r X-Received: by 2002:a17:902:efc6:b0:1b8:76ce:9d91 with SMTP id ja6-20020a170902efc600b001b876ce9d91mr8855656plb.1.1695050757445; Mon, 18 Sep 2023 08:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695050757; cv=none; d=google.com; s=arc-20160816; b=pwmMWW5Hny5tlEc0YBjiLe1/i5YzJoLr1AcabesMyYKEpZD5DdKN7AagTplc0GYZjU Rpzo7P5o12UCOR++yQlU3u2qWzXWYzeiSbCnOGoO8ktMbnyoxaFOEGquTMXY29cScMup zk3sFhUGDMvNsqj0T1WwfkqaILAprKb8v//ZWplLmN2ICf/bHNmbvsPyFXFiDxVKZD3k mSUJuUH/0ccyYcMAt9E621tNZFYLz2tBUi4kjqgcIK4yySy8X50T812E6dYaex90ijs7 nErEVyFHsHLK0nNW7DoW8+4N8P70Vmq9hP1sjSIp5jMisRAsxzP3nm9oxlaI6Ui1Mp2T t54A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=2mX0sCWmTJ1KYyxlpC6zG4V1v2jLLQZnsFIqYr5Qr0c=; fh=M66UocBKymJY7ffb9BvGBolzkW+HHQhDCxZoTxsWrEQ=; b=vswnxzL/lkBW/gg9gTfAllCwajcz2NhMhgeF43XNOnLc/+1RVSrUtAdiN5XydFpQfg y5gTj+8uW8NPCjGOhzRYxLDJ7Smr7188zPKXznvt/ebVnXI83AlSttrcMxK5/URcvbuv i0ZJrPKUHw+e/bZBlRQpWndw/sT3XrIydjk7n69U1wwS+0RhKSHUq1oFknAn4TFE8C7Z SNAeodcNH7aCT9oM8vLZc0mbnHs+hV5/+uzmzbWkpVBd7h3qX4Lyq3CE3kkdqQBNZ9FC fD1ZWFWPP2lwibQOojRNYMN1fe1NvmfQPVBn5lMbctExohdaQJt2Ow0u3R+BreC4dIKi 4SUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id i1-20020a170902cf0100b001bba8a9e29dsi8370987plg.100.2023.09.18.08.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 08:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B4A508051926; Mon, 18 Sep 2023 08:24:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240801AbjIRPXy convert rfc822-to-8bit (ORCPT + 99 others); Mon, 18 Sep 2023 11:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240708AbjIRPXq (ORCPT ); Mon, 18 Sep 2023 11:23:46 -0400 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E01E9E46; Mon, 18 Sep 2023 08:19:50 -0700 (PDT) Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-274e392a5c1so1236660a91.0; Mon, 18 Sep 2023 08:19:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695050371; x=1695655171; h=content-transfer-encoding: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=8/mKGTUlAngbWqVQW8HQgc5DCyPZMwyYYwQ45BPoCOU=; b=B/psuPlihCzFDvK9koiiItKUG9AS9YFLM7FNUTVspdusonUufHXnDM57w50uNChrvl NwYFSMBw2YMlkOXn6M806jmuOprZpHDa/j9VdS0cPaUaGtco4H/+1sUUayPQfmHScUo4 av8zuZ0+RZt9kpkUfFqOzfnkigwmPsv0HhmLqu1uHTcpiU1Lo+2Wwjz2eMbDcrJAbuHU cD21ax3jEmPRBsG0CvC6PM3KDw6j2OTw2+EM1JdKMyPMu51sSRqQQ5xCVoirzKbqymp8 RJXkq1XELIogmvzCx+U7P+CTtsec5Cy29/jEP60+QnDgHDGl6lCRG97j4al2Db3rzl2k RE8w== X-Gm-Message-State: AOJu0YxJQZnWgjvGAFHU6nX8FmrsAPMJFMoH0cGbm9s8z562F4f5oqCD 3fN3mu3ZCqynW2OdA3pKbJoAZcV2klNpMw== X-Received: by 2002:a25:4096:0:b0:d7a:d307:dd61 with SMTP id n144-20020a254096000000b00d7ad307dd61mr7614792yba.47.1695046745591; Mon, 18 Sep 2023 07:19:05 -0700 (PDT) Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com. [209.85.128.177]) by smtp.gmail.com with ESMTPSA id e202-20020a25e7d3000000b00d7b9fab78bfsm2322158ybh.7.2023.09.18.07.19.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Sep 2023 07:19:05 -0700 (PDT) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-59be9a09c23so45110407b3.1; Mon, 18 Sep 2023 07:19:05 -0700 (PDT) X-Received: by 2002:a0d:c543:0:b0:592:1bab:52bd with SMTP id h64-20020a0dc543000000b005921bab52bdmr9048947ywd.39.1695046745247; Mon, 18 Sep 2023 07:19:05 -0700 (PDT) MIME-Version: 1.0 References: <20230918-rst-updates-v1-0-17686dc06859@wdc.com> <20230918-rst-updates-v1-1-17686dc06859@wdc.com> In-Reply-To: <20230918-rst-updates-v1-1-17686dc06859@wdc.com> From: Geert Uytterhoeven Date: Mon, 18 Sep 2023 16:18:53 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] btrfs: fix 64bit division in btrfs_insert_striped_mirrored_raid_extents To: Johannes Thumshirn Cc: Chris Mason , Josef Bacik , David Sterba , Qu Wenru , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 18 Sep 2023 08:24:06 -0700 (PDT) Hi Johannes, On Mon, Sep 18, 2023 at 4:14 PM Johannes Thumshirn wrote: > Fix modpost error due to 64bit division on 32bit systems in > btrfs_insert_striped_mirrored_raid_extents. > > Cc: Geert Uytterhoeven > Signed-off-by: Johannes Thumshirn Thanks for your patch! > --- a/fs/btrfs/raid-stripe-tree.c > +++ b/fs/btrfs/raid-stripe-tree.c > @@ -148,10 +148,10 @@ static int btrfs_insert_striped_mirrored_raid_extents( > { > struct btrfs_io_context *bioc; > struct btrfs_io_context *rbioc; > - const int nstripes = list_count_nodes(&ordered->bioc_list); > - const int index = btrfs_bg_flags_to_raid_index(map_type); > - const int substripes = btrfs_raid_array[index].sub_stripes; > - const int max_stripes = trans->fs_info->fs_devices->rw_devices / substripes; > + const size_t nstripes = list_count_nodes(&ordered->bioc_list); > + const enum btrfs_raid_types index = btrfs_bg_flags_to_raid_index(map_type); > + const u8 substripes = btrfs_raid_array[index].sub_stripes; > + const int max_stripes = div_u64(trans->fs_info->fs_devices->rw_devices, substripes); What if the quotient does not fit in a signed 32-bit value? > int left = nstripes; > int i; > int ret = 0; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds