Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp497792rwi; Thu, 13 Oct 2022 00:44:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56QgjZf2raDB2aZMNbRvNxDrurC9iyLce86VJp0JuMgDI/3jaZn1ARnHCkVQg9hB92HSFq X-Received: by 2002:a17:903:22c1:b0:184:983f:11b2 with SMTP id y1-20020a17090322c100b00184983f11b2mr6799744plg.40.1665647062187; Thu, 13 Oct 2022 00:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665647062; cv=none; d=google.com; s=arc-20160816; b=bElCfIWi4uoZLXmLLsUDfQp+PXD8GBf/g9eMDEqJqLEhIn38vN85YR0KZKwAh4V55s cXerly4nlFXaRN/rsCj9iWIQMbg7CNQHiJEIreusq0FY66g+vkuLksL4LsX49sLgF3/D wtwAkrlRHEvl9bQGvwBaReIAOkXSxn7y6NGFi+wfEoHPMl2SXJGiM4p6ijAJWiVD7g3m 9ujB+fKtbokafMQ/P8pQhPOv8AI3W1sVcQIh2mENd01wvd3rgZO+oet/vL/BSJI1OuG6 RBCb7GVqHIyA4jlTAWU0IMK0/HDHjUceu7SO/idGvIrgAIpSrw9aijSnInxKut8gTmo2 gLxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=7OEj8OCTcXqSC5HaVHEW9InCKvzAtpPLeuuIHu9gcXo=; b=DFWEEso7U7+20N5vv9nl5hPjPuD1VUgA16Jbt5+hQ1J9tngrMwz6QMd4pRPwM/7UJg XtfDsMy8dQO+opXps9NIyy9bB1FEOmw6VYt8O4oAsJhbuZ/8vriieWhLDPGQ9IyS/Tjh s+7jrZX8rbk0gsEvMXEzHUys47ppCw3etzCXxKaun30RYhXJQSt8yMpwZgc57wVnFrNE tKrukCwxukQd7ikhQ3QSbVX7f5gipRTo0X9WhcJuWnRK7Wue4J+xQTYo9z7kEVjv6dGw OWw0r6n37HYvW/frpEc0xrJE6BuNrKwsjVi0Iy3itwuTho3lhxogYkexJUWXhSR3/4vz Tegg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=ErtbqFu0; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d29-20020aa797bd000000b005631ca6aad7si16181108pfq.258.2022.10.13.00.44.10; Thu, 13 Oct 2022 00:44:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@sipsolutions.net header.s=mail header.b=ErtbqFu0; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbiJMHkH (ORCPT + 62 others); Thu, 13 Oct 2022 03:40:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbiJMHkE (ORCPT ); Thu, 13 Oct 2022 03:40:04 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E41343AEE for ; Thu, 13 Oct 2022 00:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=7OEj8OCTcXqSC5HaVHEW9InCKvzAtpPLeuuIHu9gcXo=; t=1665646803; x=1666856403; b=ErtbqFu064yNGkL1nFIlzz0LAFYLDxBk98Mv8mWLon0YKmD tZAy0Y+sLZHzP5w3/j55klW5RXXDb2KtT0fX2Q6VmnW+wJCGKyPeCujxCiH79AV2QliliWmDuGTuA bAns7JpOIV/fwQ3OQpf6SN9Mt7PTumrXMoLBFjaRJRshPJQZGp2O81ah5v+R9F9ZJGncAJ83RLcrp SyFpjQ/XH6Q8WJNIykNDoZ83IURmG1HIUAyQclgOoiiKtgIeEujnwCgjXLeEBQTnnqkwceoq1P4zc ym55qfJAgoJXA5nDRFQdLuUPoXN+C2UzCPXCv4+EG5ZwC4pGGqmh3/9zAuqR8h8w==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1oisov-005bGt-2P; Thu, 13 Oct 2022 09:39:57 +0200 Message-ID: Subject: Re: [PATCH 1/8] wifi: wilc1000: fix incorrect type assignment sparse warning From: Johannes Berg To: Ajay.Kathat@microchip.com, kvalo@kernel.org Cc: linux-wireless@vger.kernel.org, Claudiu.Beznea@microchip.com, Sripad.Balwadgi@microchip.com, lkp@intel.com, hostap@lists.infradead.org, Jouni Malinen , Sunil Dutt Date: Thu, 13 Oct 2022 09:39:56 +0200 In-Reply-To: <2b432ae1-48fc-5a70-0afe-2b9f788f14e4@microchip.com> References: <20220720160302.231516-1-ajay.kathat@microchip.com> <87v8rik8vp.fsf@kernel.org> <2b432ae1-48fc-5a70-0afe-2b9f788f14e4@microchip.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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-wireless@vger.kernel.org On Wed, 2022-07-27 at 17:32 +0000, Ajay.Kathat@microchip.com wrote: >=20 > I think, there is an another way to handle this issue. 'key_mgmt_suite'= =20 > element in 'cfg80211_external_auth_params' struct should be converted to= =20 > '__be32' type(like below code snippet) because wpa_s expects the value= =20 > in big-endian format . After this change, the type case can be avoided.= =20 > Though I am not sure if these changes can have impact on other driver. >=20 Ugh. I think maybe it would be better to fix wpa_supplicant? Thing is, we use the NL80211_ATTR_AKM_SUITES attribute here for it, and even wpa_supplicant mostly uses that in host endian: num_suites =3D wpa_key_mgmt_to_suites(params->key_mgmt_suites, suites, ARRAY_SIZE(suites)); ... nla_put(msg, NL80211_ATTR_AKM_SUITES, num_suites * sizeof(= u32), suites)) with static int wpa_key_mgmt_to_suites(unsigned int key_mgmt_suites, u32 suites[= ], int max_suites) { int num_suites =3D 0; #define __AKM(a, b) \ if (num_suites < max_suites && \ (key_mgmt_suites & (WPA_KEY_MGMT_ ## a))) \ suites[num_suites++] =3D (RSN_AUTH_KEY_MGMT_ ## b) __AKM(IEEE8021X, UNSPEC_802_1X); and also case WPA_KEY_MGMT_FT_FILS_SHA384: mgmt =3D RSN_AUTH_KEY_MGMT_FT_FILS_SHA384; break; case WPA_KEY_MGMT_PSK: default: mgmt =3D RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X; break; } wpa_printf(MSG_DEBUG, " * akm=3D0x%x", mgmt); if (nla_put_u32(msg, NL80211_ATTR_AKM_SUITES, mgmt)) return -1; Now those are all userspace->kernel direction, but also: wiphy_info_akm_suites(info, tb[NL80211_ATTR_AKM_SUITES]); which eventually uses static unsigned int get_akm_suites_info(struct nlattr *tb) { int i, num; unsigned int key_mgmt =3D 0; u32 *akms; if (!tb) return 0; num =3D nla_len(tb) / sizeof(u32); akms =3D nla_data(tb); for (i =3D 0; i < num; i++) { switch (akms[i]) { case RSN_AUTH_KEY_MGMT_UNSPEC_802_1X: so again it's in native endianness. So IMHO commit 5ff39c1380d9dea794c5102c0b6d11d1b1e23ad0 Author: Sunil Dutt Date: Thu Feb 1 17:01:28 2018 +0530 SAE: Support external authentication offload for driver-SME cases is the problem there in that it assumed big endian for a value that's clearly not meant to be big endian. And what garbage out-of-tree drivers do we don't know ... Even in the kernel, we have static int qtnf_event_handle_external_auth(struct qtnf_vif *vif, const struct qlink_event_external_auth *ev, u16 len) { struct cfg80211_external_auth_params auth =3D {0}; [...] auth.key_mgmt_suite =3D le32_to_cpu(ev->akm_suite); [...] ret =3D cfg80211_external_auth_request(vif->netdev, &auth, GFP_KERN= EL); but maybe that was never tested? johannes