Return-path: Received: from mtiwmhc13.worldnet.att.net ([204.127.131.117]:64951 "EHLO mtiwmhc13.worldnet.att.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756784AbYILC6Y (ORCPT ); Thu, 11 Sep 2008 22:58:24 -0400 Message-ID: <48C9DACE.5040308@lwfinger.net> (sfid-20080912_045844_308760_5EB32668) Date: Thu, 11 Sep 2008 21:58:22 -0500 From: Larry Finger MIME-Version: 1.0 To: Steven Noonan CC: LKML , wireless Subject: Re: I need help with a sparse warning References: <48C9D040.8010107@lwfinger.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Sender: linux-wireless-owner@vger.kernel.org List-ID: Steven Noonan wrote: > On Thu, Sep 11, 2008 at 7:13 PM, Larry Finger wrote: >> In file drivers/net/wireless/p54/p54common.c, the statement >> >> priv->rx_mtu = (size_t) le16_to_cpu((__le16)bootrec->data[10]); >> >> generates the sparse warning >> >> .../p54common.c:185:29: warning: cast to restricted __le16 >> >> where bootrec->data is u32, and priv->rx_mtu is u16. >> > > (Whoops, didn't CC the mailing lists. Sorry about the double-message, Larry.) > > If priv->rx_mtu is u16, I'm surprised it doesn't get noisy about the > size_t cast. Unless the machine it's being compiled on is 16-bit, that > should throw a truncation warning, because size_t should be a 32-bit > integer on 32-bit machines (typically). > > I think if you change the (__le16) cast to (__le16 __force) it will > stop warning you about that particular issue. This one gets rid of the sparse warning. priv->rx_mtu = le16_to_cpu((__le16 __force) bootrec->data[10]); Thanks, Larry