Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1808764pxb; Fri, 20 Aug 2021 14:47:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEgPHkWtel1TY4eGdsuXfh4rg8R33RTZTc6kj+WlBuT+GDPJS+dmwuWCcF0V/N/Onbrt7x X-Received: by 2002:a5d:8506:: with SMTP id q6mr17553478ion.53.1629496043455; Fri, 20 Aug 2021 14:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629496043; cv=none; d=google.com; s=arc-20160816; b=Lm1SCIxIMDbXQfLplCe7FTOcGylS5njMp7CoRrdlzfGrN9HtXpigAFQfOnjLw8Yo31 cnS9vH8l7vr0q11w3lCV0AC+eoUdj9Zl54DvwzO7W+BoAQkJnGoX4b0OJWKF+bsC73Zi NgFFcggsRxnEijyEGXIr52aLN7kF7NtGUAg/+vTfgj5FCBgY7PNL8RFKsXoqFocRAHat 34m/8u4nb9ieh+giNbRahVtzkq2YSHpJvdCccfCtpfnZHwH3v9DF1qbtT39kEug1DT+V yTQ90zg/agbXhz5Avp7/wfL1TFZPsK2y85hn+9IELHNMlKwDG2VFxCcDARsG/LFtHw4v GK5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:sender:dkim-signature; bh=sdBtLLcxFh85B7imhpoS1jrj2mYz3GQrzK1SA3JSPBc=; b=TLRYJ5Xrvt0qSLzlhrkl0D8Lwd0XBD7+P2rRavJMR+n83VZh/q0Cz/oH/IUdciF9Dd SZyKKPbnWFJkSHm15Ht58dU82l8HWOwO/D3ilnAHdFCKtUcjU2M1bMyO/obRcZMuRgcV m4JLWqc+Ac4yS85XsXmeV1g9wj6XSeLzH8fGrL6MlDpKKnx85DVssaHRZZwx5EmiTVik NEpaHLUXN2V6487E+rf3B++pVC6ZdDKthkuzBMyyafvNewRDNffbhMXK7W+WCgrUHAqI JLevlJlOToLGfh8eHugCyKgnp9ZWH5Tzd0VmwbQPXycCCkvS0an3ksy2dQolv9RFq7qq IO5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ymx1V8Tz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si9500867ilf.63.2021.08.20.14.47.11; Fri, 20 Aug 2021 14:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ymx1V8Tz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230498AbhHTVpa (ORCPT + 99 others); Fri, 20 Aug 2021 17:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbhHTVp3 (ORCPT ); Fri, 20 Aug 2021 17:45:29 -0400 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB507C061575 for ; Fri, 20 Aug 2021 14:44:51 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id 61-20020a9d0d430000b02903eabfc221a9so17272941oti.0 for ; Fri, 20 Aug 2021 14:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=sdBtLLcxFh85B7imhpoS1jrj2mYz3GQrzK1SA3JSPBc=; b=Ymx1V8TzLYDcDqYJ/At9cSPdQ3bHct1g2Kr6Mtw5NjPyKpRn0fzpgwcpfZwC5DWfOI sCBlsjJ9h4mBw5HogM+Iea8kk5/h4yA20FI9rYmLMGm1a0BozIuav8hXt8Uq3pLVjpvB PPlG35gEeN1Jm1cVZvzqZiNzh7DWrPkeUHdAj8M3/dBl7xArr2zHXZuB9QHf15F2NznY +HrLp0nPzILP5lrEXnysznE2egUIC4Iay0ALS4u7/uZZ6qZHsL1sYdRT2PGej2CxF1f7 r0aCX6rbwEb2ISBDLlEAxXW2PuGMpNpYzZ8xpMnRi+7UiYH9lmapoXDq8iUbQW3+ljuL zGdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=sdBtLLcxFh85B7imhpoS1jrj2mYz3GQrzK1SA3JSPBc=; b=HChTXR6CwWM+5ToSpd7rtVShV0hkN8uNGybzaSBNPHiYEDpX9LU1MLHMS6CvEgFlPb arfPd9yUhkarUdY2rU7DsYpoDDwTkrd1cPcXV/BGV+8lh03u0ddh9QE1RnSKdzwIM9Ix h4LfC0cyNwv9Ss+Qgr2kBeaq88kO9S4P2EUeviddpPG303li8hDO1xDoWICvzHxOLmaI olmNO23s5+u8L1PchziUqFNMcIw46g4XtamfYrR5mDISoOaGs7nW5HWoeT7wK9ehZ7Ng UVuRwfOss8gn8mkFw7tEgIX5QAz3ykuzGTwovxDTuSDxRcg9TrLwJ4p7sXFe2gCdb9dS XpMg== X-Gm-Message-State: AOAM533N6gQB5LYNB3Cd8n6BVsUEFfXYEXJlhECvKJKJD7qYffpLnpy4 zjw+8VV/rqOPpSFlLq0diW7dGKSEkH0= X-Received: by 2002:a05:6808:90a:: with SMTP id w10mr4625994oih.164.1629495890817; Fri, 20 Aug 2021 14:44:50 -0700 (PDT) Received: from 2603-8090-2005-39b3-0000-0000-0000-1023.res6.spectrum.com (2603-8090-2005-39b3-0000-0000-0000-1023.res6.spectrum.com. [2603:8090:2005:39b3::1023]) by smtp.gmail.com with ESMTPSA id m6sm1708799otf.52.2021.08.20.14.44.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Aug 2021 14:44:50 -0700 (PDT) Sender: Larry Finger Subject: Re: [PATCH v2 2/5] staging: r8188eu: cast to restricted __be32 To: Aakash Hemadri , Greg Kroah-Hartman , Phillip Potter Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org References: <602aefc30b0d979dc6e402d52da2f096ea5c67cf.1629360917.git.aakashhemadri123@gmail.com> From: Larry Finger Message-ID: <4be5c5fa-c3fd-8c86-e904-8e2e60173380@lwfinger.net> Date: Fri, 20 Aug 2021 16:44:49 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <602aefc30b0d979dc6e402d52da2f096ea5c67cf.1629360917.git.aakashhemadri123@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/19/21 3:17 AM, Aakash Hemadri wrote: > Fix sparse warning: >> rtw_br_ext.c:836:54: warning: cast to restricted __be32 > > Unnecessary double cast, remove them. > > Signed-off-by: Aakash Hemadri > --- > drivers/staging/r8188eu/core/rtw_br_ext.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c > index 404fa8904e47..6a0462ce6230 100644 > --- a/drivers/staging/r8188eu/core/rtw_br_ext.c > +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c > @@ -671,7 +671,7 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb) > (udph->dest == __constant_htons(SERVER_PORT))) { /* DHCP request */ > struct dhcpMessage *dhcph = > (struct dhcpMessage *)((size_t)udph + sizeof(struct udphdr)); > - u32 cookie = be32_to_cpu((__be32)dhcph->cookie); > + u32 cookie = dhcph->cookie; > > if (cookie == DHCP_MAGIC) { /* match magic word */ > if (!(dhcph->flags & htons(BROADCAST_FLAG))) { > This patch is wrong. All the documentation I could find tells me that the multi-byte entries in dhcph are big-endian, thus the new line should read: u32 cookie = be32_to_cpu(dhcph->cookie); combined with: @@ -649,7 +650,7 @@ struct dhcpMessage { u_int8_t chaddr[16]; u_int8_t sname[64]; u_int8_t file[128]; - u_int32_t cookie; + __be32 cookie; u_int8_t options[308]; /* 312 - cookie */ }; The old code was, in fact, correct, but not in a way that satisfied Sparse. Larry