From patchwork Fri Jun 16 09:24:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 108995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1202788vqr; Fri, 16 Jun 2023 02:41:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uma8mm8rZyErLWFbaufVXFhpclvmPBszrMD9VklR8lzXqe05rd2lZm7wN0sZRPzp7XRUG X-Received: by 2002:a05:6a20:1454:b0:118:ed8a:af45 with SMTP id a20-20020a056a20145400b00118ed8aaf45mr2149008pzi.40.1686908518022; Fri, 16 Jun 2023 02:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686908518; cv=none; d=google.com; s=arc-20160816; b=hSyvl5beShid4tGbqkqLuV8K657K1q1zQo8CBa9FQMR0FXp4c5c+ogMEbFBrUp+xLf mCmQIEOWXstLFlG64DoOwkoNvXZJAzFzw+RPO58b3oCcvLKhYvBuDp1/xXs5vOHSIo8g 3nSwit9epoRSX4rjxtaWcaOBdVn1euSIbUoN8lH87ccu4zQ+Qr2NzSn6OoVnn27Z54mN oyXs5xIWvkcrL0wNRFarIIrpagttC44mICCxoO3HA9HylkpCwQcBFscuT4xcOQgMqs2C Gw7GsgCH311QhjC7Jntyv5G7zh1U5CGxNa2ccOeE1bFKVqIFYM3vYcgB3Zn0vDYRy3fD t4pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=SwMUNuck5BugtzVNI+U+CfvZsXcsdgfylwJ3YAYbkYo=; b=fNfLzpy7KA6PqRhftkzrJ8M7fRUJzXEkWzgZ/zYH9buvxKuiKhxEbGdXIbqC+JWZH6 3RrYnZM31xZi7g6s1tU31S1sBIVpDrGqB5DoJvxpULxnK2psavl6N662YKnQYF2bdegM 4DWyJrrIR9qWFRjA07CumdqzI60Z7eZjTU9oehQSxbXY/s92pC5b9F/Qy5TuRUY1V3V8 Kvi0P2bu/Y/wZDEkIcdpjEduXI1hjJx5IxWKOVlc1sDa8IN0kq+cemmE6VYq6z9GZ7Sg rmQm8JHqADW0MoToy++pJ3oFu6GzOnfU97qCYTxUpTHjKUtTBLlbTK5LPQdAftSa5TDk tHTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HWwpM+qf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i63-20020a636d42000000b0055383dd0c76si120433pgc.736.2023.06.16.02.41.43; Fri, 16 Jun 2023 02:41:58 -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=@kernel.org header.s=k20201202 header.b=HWwpM+qf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344225AbjFPJ0v (ORCPT + 99 others); Fri, 16 Jun 2023 05:26:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344440AbjFPJ0a (ORCPT ); Fri, 16 Jun 2023 05:26:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7561435A2; Fri, 16 Jun 2023 02:25:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED9DB63291; Fri, 16 Jun 2023 09:25:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F689C433C8; Fri, 16 Jun 2023 09:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686907538; bh=XHQLN9nl8TdAAC8nr9pRDK1MMoc21zbzvmAMT6d+aV8=; h=From:To:Cc:Subject:Date:From; b=HWwpM+qfAVvgds/zGb334+M25YQhO4zvPLkXeZuxOO6aLId+XwaBREqJ6hREUpJo5 EJW8rExR4qi4/YMSgUPGdgdWX9LiWvs9E8h31BS7/iqKGuUwDq/eOEVcJ/d/lug0dv wG1DCN7/T8kEpgumUCGYp8bCZ5VHOmBQ7p5GT12nvk0ehAzrIb8OmoRodmdbYtVQqo v+xlbGgGnylf+NqrZqYjX7GFMUXoQYr0QQ4gA3SmlCRguzjhLxaW8EDIo11R1fEMF2 06F5f0v+u3x1AdpNHCrTxPc2PFnAWWJpU3wsxZ7x7vjNdXPo/IKWKUV/0qbB1gH7H4 1BcDrDR0d8d8w== From: Arnd Bergmann To: Song Liu , Yu Kuai Cc: Arnd Bergmann , Damien Le Moal , Jens Axboe , Johannes Thumshirn , linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] md/raid1-10: shut up randstruct warning again Date: Fri, 16 Jun 2023 11:24:48 +0200 Message-Id: <20230616092532.3307719-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768851162548074645?= X-GMAIL-MSGID: =?utf-8?q?1768851786450564582?= From: Arnd Bergmann A code reorganization brought back a warning when structure randomization is enabled: drivers/md/raid1-10.c:119:25: error: casting from randomized structure pointer type 'struct block_device *' to 'struct md_rdev *' struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev; ^ Before the rework, this used a (void*) cast, so go back to that in order to avoid the warning. Casting between pointers to incompatible types is clearly something that is dangerous, but this driver has always done so, and it's not made any worse by the struct randomization in this case. Fixes: 8295efbe68c08 ("md/raid1-10: factor out a helper to submit normal write") Signed-off-by: Arnd Bergmann --- drivers/md/raid1-10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c index 169ebe296f2d0..3f22edec70e78 100644 --- a/drivers/md/raid1-10.c +++ b/drivers/md/raid1-10.c @@ -116,7 +116,7 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, static inline void raid1_submit_write(struct bio *bio) { - struct md_rdev *rdev = (struct md_rdev *)bio->bi_bdev; + struct md_rdev *rdev = (void *)bio->bi_bdev; bio->bi_next = NULL; bio_set_dev(bio, rdev->bdev);