[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202306211133.DD89F45965@keescook>
Date: Wed, 21 Jun 2023 11:33:29 -0700
From: Kees Cook <keescook@...omium.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Anil Gurumurthy <anil.gurumurthy@...gic.com>,
Sudarsana Kalluru <sudarsana.kalluru@...gic.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Arnd Bergmann <arnd@...db.de>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>,
Bart Van Assche <bvanassche@....org>,
Azeem Shaikh <azeemshaikh38@...il.com>,
Krishna Gudipati <kgudipat@...cade.com>,
James Bottomley <JBottomley@...allels.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH 1/2] scsi: bfa: fix function pointer type mismatch for
hcb_qe->cbfn
On Fri, Jun 16, 2023 at 11:22:09AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> Some callback functions used here take a boolean argument, others
> take a status argument. This breaks KCFI type checking, so clang
> now warns about the function pointer cast:
>
> drivers/scsi/bfa/bfad_bsg.c:2138:29: error: cast from 'void (*)(void *, enum bfa_status)' to 'bfa_cb_cbfn_t' (aka 'void (*)(void *, enum bfa_boolean)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>
> Assuming the code is actually correct here and the callers always match
> the argument types of the callee, rework this to replace the explicit
> cast with a union of the two pointer types. This does not change the
> behavior of the code, so if something is actually broken here, a larger
> rework may be necessary.
>
> Fixes: 37ea0558b87ab ("[SCSI] bfa: Added support to collect and reset fcport stats")
> Fixes: 3ec4f2c8bff25 ("[SCSI] bfa: Added support to configure QOS and collect stats.")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists