Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9812876rwd; Wed, 21 Jun 2023 12:11:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52vkPBwfILG0VlUN0FYOaZe3ISSpmawiAOalYQF2up+3OGIMeVPUuP5UAYIEBg08RZtCN6 X-Received: by 2002:a05:6a00:248c:b0:66a:3eb5:92c6 with SMTP id c12-20020a056a00248c00b0066a3eb592c6mr3779772pfv.9.1687374719423; Wed, 21 Jun 2023 12:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687374719; cv=none; d=google.com; s=arc-20160816; b=kW/1ITGlEEElj5QMjqUr8UJOjPcxYziKP7F4qI/7JzkGkSKeYkh0YOZb0OukfhMvsl xnzlIB/fRmIHZwGWD93UYWG58Bxj45cKhfK/Sr3TVVv13tffufbjZYrnjGAEdLtlFpbh 72Rqs2tFVMM7D6JqzjY20GKZsBXd3COydjjn9Pp2KSWD/K6LJ/7ADNwMEWeDOcPW4pn2 BdgKB9THTXTqf3SpI/kZNLxwAIWn7qY67NkFVs4hguiO+nvN8K1YKS5hm4AneRJjF0D/ 3iJMFOtUZcyCrrPQa8nkVytoWpxlMDeGoj9mFy6aRrwUN+96ORI9R2Krlk+zm0d5n5hV 2cig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JMCcSs/LNtvhK0BXk5UBwN4S171el/6E9/JAkRmkQ14=; b=v+bWg+1HPmBldLvrN3GMGdOdWzALeJAhU2kIjmnF2jqVPwW5Dui3ow92/JfBBxsYUx hqMMKvTTntJWnRb6ikmiR6o0kfQ/A0pe+3XkpNjcmCp1wjGBHJWwGDhJ8/zmQAkVtULb M+Cet1ep4zO9rxsmkiRTj6Sp8QXzclhl/WfJpPfOnd80QWxKfk2afu7cCy2TaRQEMLJR LB8iC2xm0nYMKGEU2tkJsSy3FLjzOIoQzOz8nAkdBzPHqRiPBJgk6cC1mAoiity2OdYW Ed3JgolP851u78C7SeQcxGn3oBBUt/hNKK2ltVWW40/SExeHpLRcGi4uGDf0sZkg9RQH OMrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HdwxOHbS; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020aa79f82000000b0064f735aef04si4777696pfr.209.2023.06.21.12.11.47; Wed, 21 Jun 2023 12:11:59 -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=@chromium.org header.s=google header.b=HdwxOHbS; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjFUSdX (ORCPT + 99 others); Wed, 21 Jun 2023 14:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjFUSdW (ORCPT ); Wed, 21 Jun 2023 14:33:22 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DA841A4 for ; Wed, 21 Jun 2023 11:33:21 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-66615629689so5253014b3a.2 for ; Wed, 21 Jun 2023 11:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687372400; x=1689964400; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JMCcSs/LNtvhK0BXk5UBwN4S171el/6E9/JAkRmkQ14=; b=HdwxOHbSoqUwOb6scyLytVCNBpr1vwNnQT2D/hW5FKgqNmiGZBEUds0gb7Mwid3xVY 1EVF6TIlDX37MMcT1uuuEKRQMF7BlHM+djkdvHuJnJlP97NE5a1yHBHKxcdlP1JLWij5 95LAF3n+A/3JrQmWPhQu/6H9+TM2x6GB51clo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687372400; x=1689964400; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JMCcSs/LNtvhK0BXk5UBwN4S171el/6E9/JAkRmkQ14=; b=UZZ/bzm7yuvhEplgdAqggv0lCIAe1FOdBd65F73xn0fls0UJvLkLdF1s6RceHho6sv ur1+zQrBJCF9RWigYrU44OILVEOM4j6FUQzsYB4hY6mEowp875dziaU1VkRpXSokkLk2 UwuPGOzsxdrF8b449OGrXR0B6AUFsH1d2NT++XyMqDLbHgUCfkYOB2Vg8m5aUtz4LVax 8eWCkspdlp5KFt4IYS+kFmj7QwbIaEobqp637FgdH3sPFk6+xp/vvwdflt0KwpIeqTKY W9Obce5UQH7PJAvzVwonqpVdfxLR57aWa0Q3m6LAYOFV57Xkk8RTk1pDMgq9rIksuGGA hgbA== X-Gm-Message-State: AC+VfDwKZHUNAy/iqxdxuVBiWN+/3OHsRzm082B6gTXlLNAFJ5zHe3Rw YQYztj8SeCwvxdw2w1mIVZuWsA== X-Received: by 2002:a05:6a20:244a:b0:10e:440:6d36 with SMTP id t10-20020a056a20244a00b0010e04406d36mr19792675pzc.1.1687372400488; Wed, 21 Jun 2023 11:33:20 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id e20-20020a62ee14000000b00665a76a8cfasm3193283pfi.194.2023.06.21.11.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 11:33:19 -0700 (PDT) Date: Wed, 21 Jun 2023 11:33:18 -0700 From: Kees Cook To: Arnd Bergmann Cc: Anil Gurumurthy , Sudarsana Kalluru , "James E.J. Bottomley" , "Martin K. Petersen" , Arnd Bergmann , Azeem Shaikh , Bjorn Helgaas , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] scsi: bfa: fix function pointer type mismatch for state machines Message-ID: <202306211131.18885FF471@keescook> References: <20230616092233.3229414-1-arnd@kernel.org> <20230616092233.3229414-2-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230616092233.3229414-2-arnd@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Fri, Jun 16, 2023 at 11:22:10AM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > The bfa driver is full of state machines and a generic abstraction layer > for them. This relies on casting function pointers, but that is no longer > allowed when CONFIG_CFI_CLANG is enabled and causes a huge number of > warnings like: > > drivers/scsi/bfa/bfad.c:169:3: error: cast from 'void (*)(struct bfad_s *, enum bfad_sm_event)' to 'bfa_sm_t' (aka 'void (*)(void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] > bfa_sm_set_state(bfad, bfad_sm_created); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Rework the mechanism to no longer require the function pointer casts, > by having separate types for each individual state machine. This in > turn requires moving the enum definitions for each state machine > into the header files in order to define the typedef. > > Signed-off-by: Arnd Bergmann Thanks for all this! It's a lot of mechanical changes, but looks correct to me. One nit below... Reviewed-by: Kees Cook > [...] > static void > -bfad_sm_uninit(struct bfad_s *bfad, enum bfad_sm_event event); > +bfad_sm_uninit(struct bfad_s *bfad, enum bfad_sm_event); > static void > -bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event); > +bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event); > static void > -bfad_sm_initializing(struct bfad_s *bfad, enum bfad_sm_event event); > +bfad_sm_initializing(struct bfad_s *bfad, enum bfad_sm_event); > static void > -bfad_sm_operational(struct bfad_s *bfad, enum bfad_sm_event event); > +bfad_sm_operational(struct bfad_s *bfad, enum bfad_sm_event); > static void > -bfad_sm_stopping(struct bfad_s *bfad, enum bfad_sm_event event); > +bfad_sm_stopping(struct bfad_s *bfad, enum bfad_sm_event); > static void > -bfad_sm_failed(struct bfad_s *bfad, enum bfad_sm_event event); > +bfad_sm_failed(struct bfad_s *bfad, enum bfad_sm_event); > static void > -bfad_sm_fcs_exit(struct bfad_s *bfad, enum bfad_sm_event event); > +bfad_sm_fcs_exit(struct bfad_s *bfad, enum bfad_sm_event); This bit doesn't seem needed? i.e. why remove the prototype's argument names? -- Kees Cook