From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD565C4338F for ; Wed, 25 Aug 2021 10:21:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B17566120A for ; Wed, 25 Aug 2021 10:21:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239851AbhHYKWW convert rfc822-to-8bit (ORCPT ); Wed, 25 Aug 2021 06:22:22 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]:56258 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237516AbhHYKWR (ORCPT ); Wed, 25 Aug 2021 06:22:17 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-68-2GvGDmlwPsiQ0AnOLMju9A-1; Wed, 25 Aug 2021 11:21:25 +0100 X-MC-Unique: 2GvGDmlwPsiQ0AnOLMju9A-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 25 Aug 2021 11:21:23 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.023; Wed, 25 Aug 2021 11:21:23 +0100 From: David Laight To: 'Dan Carpenter' CC: 'Larry Finger' , Aakash Hemadri , Greg Kroah-Hartman , Phillip Potter , "linux-staging@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v3 2/5] staging: r8188eu: cast to restricted __be32 Thread-Topic: [PATCH v3 2/5] staging: r8188eu: cast to restricted __be32 Thread-Index: AQHXmCqSnSVpiVCtaEyxz8Go65B0FauD8RPg///yZ4CAACGg0A== Date: Wed, 25 Aug 2021 10:21:23 +0000 Message-ID: References: <50439a81aca7ce8c3c97ec1c7247f4cd03f645a5.1629562355.git.aakashhemadri123@gmail.com> <20210823084426.yo2mhgbyehkwwz3h@xps.yggdrasil> <25d336b5-8008-9b3b-7efe-a82afaea0e98@lwfinger.net> <20210825091921.GR1931@kadam> In-Reply-To: <20210825091921.GR1931@kadam> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter > Sent: 25 August 2021 10:19 > > On Wed, Aug 25, 2021 at 09:13:44AM +0000, David Laight wrote: > > From: Larry Finger > > > Sent: 23 August 2021 15:24 > > > > > > On 8/23/21 3:44 AM, Aakash Hemadri wrote: > > > > On 21/08/21 09:48PM, Aakash Hemadri wrote: > > > >> Fix sparse warning: > > > >>> rtw_br_ext.c:836:54: warning: cast to restricted __be32 > > > >> > > > >> dhpch->cookie is be32, change it's type. > > ... > > > >> diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c > b/drivers/staging/r8188eu/core/rtw_br_ext.c > > > >> index f6d1f6029ec3..f65d94bfa286 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)); > > > > This assignment looks dubious at best - WTF is (size_t) for? > > I don't seem to have a source tree with this driver in it (probably only in 'next'?). > > I suspect it should be: > > struct dhcp_message *dhcph = (void *)(udph + 1); > > Those are equivalent. Either way works. size_t isn't guaranteed to be large enough to hold a pointer. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)