From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759067AbdCVJ0z (ORCPT ); Wed, 22 Mar 2017 05:26:55 -0400 Received: from aserp1050.oracle.com ([141.146.126.70]:43991 "EHLO aserp1050.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758489AbdCVJ0p (ORCPT ); Wed, 22 Mar 2017 05:26:45 -0400 Date: Wed, 22 Mar 2017 12:24:04 +0300 From: Dan Carpenter To: Robert Perry Hooker Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, ganesh.krishna@microchip.com, linux-kernel@vger.kernel.org, aditya.shankar@microchip.com Subject: Re: [PATCH] staging: wilc1000: use kernel define byte order macros Message-ID: <20170322092403.GF32449@mwanda> References: <1490126140-12867-1-git-send-email-perry.hooker@gmail.com> <20170321201904.GD32449@mwanda> <1490132410.17318.6.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490132410.17318.6.camel@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserp1040.oracle.com [141.146.126.69] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 21, 2017 at 03:40:10PM -0600, Robert Perry Hooker wrote: > Thanks for taking a look, Dan. Sorry if I missed the mark here. > > Can you tell me a bit more about the bug this would introduce? > > I see that ieee80211_is_action is defined like this: static inline bool ieee80211_is_action(__le16 fc) > > ...and that buff[FRAME_TYPE_ID]is a u8 (since FRAME_TYPE_ID = 0). > > Is there an issue with calling cpu_to_le16 on a u8 that isn't encountered by implicitly casting a u8 to __le16? Or am I > missing something else? > Oh... Hm. You're right. I just was thinking that since buff was a little endian buffer but it's only reading a u8. It should probably be reading a le16... The buff likely is just a regular ieee80211_hdr struct. So you're fixing a bug, but probably not in the right way. We should instead just say "struct ieee80211_hdr *hdr = buff;" and instead of treating it like an array of u8. Probably it requires testing... regards, dan carpenter