public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH v3 7/7] staging: ks7010: Avoid clashing function prototypes
Date: Wed, 9 Nov 2022 16:10:52 -0800	[thread overview]
Message-ID: <202211091610.8D12F1F@keescook> (raw)
In-Reply-To: <8d2ceee1248b5a76e9b6c379f578e65482c91168.1667934775.git.gustavoars@kernel.org>

On Tue, Nov 08, 2022 at 02:34:46PM -0600, Gustavo A. R. Silva wrote:
> When built with Control Flow Integrity, function prototypes between
> caller and function declaration must match. These mismatches are visible
> at compile time with the new -Wcast-function-type-strict in Clang[1].
> 
> Fix a total of 27 warnings like these:
> 
> drivers/staging/ks7010/ks_wlan_net.c:2415:2: warning: cast from 'int (*)(struct net_device *, struct iw_request_info *, struct iw_point *, char *)' to 'iw_handler' (aka 'int (*)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *)') converts to incompatible function type [-Wcast-function-type-strict]
>         (iw_handler)ks_wlan_get_firmware_version,/* 3 KS_WLAN_GET_FIRM_VERSION */
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> The ks_wlan_net Wireless Extension handler callbacks (iw_handler) use a
> union for the data argument. Actually use the union and perform explicit
> member selection in the function body instead of having a function
> prototype mismatch. There are no resulting binary differences
> before/after changes.
> 
> These changes were made partly manually and partly with the help of
> Coccinelle.
> 
> Link: https://reviews.llvm.org/D134831 [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

The "mode" churn makes this a bit harder to review, but I think the
final result looks better.

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

      reply	other threads:[~2022-11-10  0:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 20:18 [PATCH v3 0/7] Avoid clashing function prototypes Gustavo A. R. Silva
2022-11-08 20:21 ` [PATCH v3 1/7] wifi: orinoco: " Gustavo A. R. Silva
2022-11-10  0:06   ` Kees Cook
2022-11-16  9:32   ` Kalle Valo
2022-11-08 20:23 ` [PATCH v3 2/7] cfg80211: " Gustavo A. R. Silva
2022-11-10  0:06   ` Kees Cook
2022-11-08 20:25 ` [PATCH v3 3/7] wifi: hostap: " Gustavo A. R. Silva
2022-11-10  0:07   ` Kees Cook
2022-11-08 20:26 ` [PATCH v3 4/7] wifi: zd1201: " Gustavo A. R. Silva
2022-11-08 20:27 ` [PATCH v3 5/7] wifi: airo: " Gustavo A. R. Silva
2022-11-08 20:31 ` [PATCH v3 6/7] bna: " Gustavo A. R. Silva
2022-11-10  5:43   ` Kalle Valo
2022-11-11 16:46     ` Gustavo A. R. Silva
2022-11-08 20:34 ` [PATCH v3 7/7] staging: ks7010: " Gustavo A. R. Silva
2022-11-10  0:10   ` Kees Cook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202211091610.8D12F1F@keescook \
    --to=keescook@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox