From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751135AbbEGDKf (ORCPT ); Wed, 6 May 2015 23:10:35 -0400 Received: from mail-qc0-f179.google.com ([209.85.216.179]:34516 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730AbbEGDKe convert rfc822-to-8bit (ORCPT ); Wed, 6 May 2015 23:10:34 -0400 Message-ID: <554AD76E.7060605@gmail.com> Date: Thu, 07 May 2015 00:09:34 -0300 From: Gaston Gonzalez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Dan Carpenter CC: devel@driverdev.osuosl.org, arnd@arndb.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, joe@perches.com, navyasri.tech@gmail.com Subject: Re: [PATCH] staging: rtl8192u: ieee80211: Silence sparse warning References: <1429476231-6197-1-git-send-email-gascoar@gmail.com> <20150420082441.GU10964@mwanda> <553C18B6.807@gmail.com> <20150427101242.GR14154@mwanda> In-Reply-To: <20150427101242.GR14154@mwanda> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/04/15 07:12, Dan Carpenter wrote: > Can't we just export the tkip.c function? > > regards, > dan carpenter > Hi Dan, (sorry for the delayed response) The inputs of the two implementations of tkip_mixing_phase2() differ in one parameter: - ieee80211_crypt_tkip.c expects 'const u16 *TTAK' - tkip.c expects 'struct tkip_ctx *ctx' tkip_mixing_phase2() is called two times in ieee80211_crypt_tkip.c: git grep tkip_mixing_phase2 drivers/staging/rtl8192u/ieee80211/ drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c: tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c: tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); tkey is a 'struct ieee80211_tkip_data', which differs from tkip_ctx structure. So in the case of exporting the tkip.c function, we would need to add 'struct tkip_ctx' definition, and not just change the function input definition. The only member of tkip_ctx structure used in tkip_mixing_phase2() is p1k, which is the equivalent of TTAK array in ieee80211_crypt_tkip.c . Thus - I'm new to this so I may be missing something - one way would be to just add the tkip_ctx structure definition in ieee80211_crypt_tkip.c. The down side of doing this is that there would be some parameters defined twice in two different structures: u32 iv32, u16 iv16, u16 p1k[5], u32 p1k_iv32 Another way would be split ieee80211_tkip_data structure in struct tkip_ctx on one side, and leave the rest of the members on the original structure. This would avoid to duplicate the members definitions, but I guess that approach could broke other things... As I said, I'm new to this so I may be missing something, maybe a different approach? One detail: although not used in the function, 'enum ieee80211_internal_tkip_state state' is not defined in 'struct ieee80211_tkip_data', thus in any case that definition would have to be added. regards, Gaston