Received: by 2002:a05:6520:3645:b029:c0:f950:43e0 with SMTP id l5csp327594lki; Mon, 22 Feb 2021 07:34:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwh7DD5qYsRaE6EhDy6TLNFpOfJiaghfFLIY7UZGzldMpifXtAK4MkUw5231SyEOJPKB0Xw X-Received: by 2002:a17:906:2e91:: with SMTP id o17mr18316156eji.488.1614008095306; Mon, 22 Feb 2021 07:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614008095; cv=none; d=google.com; s=arc-20160816; b=Am/+Vk1axpQ6Alh0gbNBDQflhXpuy34BeVndb88ePYDwNaW0dwYCG4mIzhQ6elR+5I n0vclyKEl4PNk2xuosLN/K7EbU36n2YH00EuAPT/3rikjkv23rK8/irgNrIpzzL/KdvH S2ONRAdATBePHccXZDUIHixw+cP+KrM2XoZyS7WTvmzYRsY58Pvmhh0ezSYScLYYdJmM XkYXNhVmGFoDxiuJIzZ+hIEkvYJSJ0KTlE5ziu9dgmUIj0HTt4Dkzjg4dOFwCFBjtHk4 TxaFzkeIqx8ZfgSVIJwtoBoPGGRN8S85dnzZnhwZxPS5NHzXeykN0CoIwGTyGjhp3wMo EwKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nakffDbFl0opzVxjW0cPU3N+fkj45mYkQ3+IN6LB/WU=; b=N3MdtTPU758KJlHZ3aFMRPykNPJvNNSmR+18piMMwOVMj2tatfGF4Pr2fvmTxn5RRV IxIsihDJVy79m7i6HJfa1NeKgHvSZ5nuC6xiVg2WsKY6jp8BBpOFzuKnNH58n3by2umW w00gF+1GtlMIDNtyuuv6VvgKwU7aK2t2yyjonv5uIoiCUC+P+J8Rytlm/deOq6Pf2xZ0 gkyD51HW2dxo/Wy6XPEffhkysJlgV5KnatG2TthI+11uW8WJYHlRra+J+NRDgIDUGqwT NTxAOp2a6/4i0KFO9fSqvZlIlRHWGPJ87BIVCX97aTzPHkZ0hBz8uNrGiZcLdRPfPOYD 18uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pz+ySTl/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg13si14566927ejc.126.2021.02.22.07.34.31; Mon, 22 Feb 2021 07:34:55 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="pz+ySTl/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbhBVPeA (ORCPT + 99 others); Mon, 22 Feb 2021 10:34:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:58230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230412AbhBVPcW (ORCPT ); Mon, 22 Feb 2021 10:32:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E2A564E76; Mon, 22 Feb 2021 15:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614007898; bh=XMEZ7PH/ni+hF/4PzC80cUBZVOIDoDWFydw/tU/lfhE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pz+ySTl/03N7Tyvbc8xOkfaa/v61t91srPxX0mzW7+7fEpiM+U55PDXRlAZE5uOSw unbPjWJBEnZ69vAvjjCsy5BuQ2QWWFstuzBRkkbNsDzxBR1Ljay6jYq3beAZvgzya8 bieDwiFexYbtu+ADcBO/xQIoz/W2VZ5snJ0J4rLs= Date: Mon, 22 Feb 2021 16:26:33 +0100 From: Greg KH To: Atul Gopinathan Cc: tiwai@suse.de, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, gustavo@embeddedor.com Subject: Re: [PATCH 2/2] staging: rtl8192e: Change state information from u16 to u8 Message-ID: References: <20210220182154.9457-1-atulgopinathan@gmail.com> <20210220182154.9457-2-atulgopinathan@gmail.com> <20210221165721.GA10040@atulu-nitro> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210221165721.GA10040@atulu-nitro> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 21, 2021 at 10:27:21PM +0530, Atul Gopinathan wrote: > On Sun, Feb 21, 2021 at 02:08:26PM +0100, Greg KH wrote: > > On Sat, Feb 20, 2021 at 11:51:55PM +0530, Atul Gopinathan wrote: > > > The "CcxRmState" field in struct "rtllib_network" is defined > > > as a u16 array of size 2 (so, 4 bytes in total). > > > > > > But the operations performed on this array throughout the code > > > base (in rtl8192e/) are all in byte size 2 indicating that this > > > array's type was defined wrongly. > > > > > > There are two situation were u16 type of this field could yield > > > incorrect behaviour: > > > > > > 1. In rtllib_rx.c:1970: > > > memcpy(network->CcxRmState, &info_element->data[4], 2); > > > > > > Here last 2 bytes (index 4 and 5) from the info_element->data[] > > > array are meant to be copied into CcxRmState[]. > > > Note that "data" array here is an array of type u8. > > > > > > 2. In function "update_network()" in staging/rtl8192e/rtllib_rx.c: > > > memcpy(dst->CcxRmState, src->CcxRmState, 2); > > > > > > Here again, only 2 bytes are copied from the source state to > > > destination state. > > > > > > There are no instances of "CcxRmState" requiring u16 data type. > > > Here is the output of "grep -IRn 'CcxRmState'" on the rtl8192e/ > > > directory for reviewing: > > > > > > rtllib_rx.c:1970: memcpy(network->CcxRmState, &info_element->data[4], 2); > > > rtllib_rx.c:1971: if (network->CcxRmState[0] != 0) > > > rtllib_rx.c:1975: network->MBssidMask = network->CcxRmState[1] & 0x07; > > > rtllib_rx.c:2520: memcpy(dst->CcxRmState, src->CcxRmState, 2); > > > rtllib.h:1108: u8 CcxRmState[2]; > > > > You just changed the logic in line 1975 in that file, right? Are you > > _SURE_ that is ok? Do you have a device to test this on? > > I'm sorry, I didn't quite get you. By line 1975 in rtllib_rx.c, did you mean > the following line?: > > network->MBssidMask = network->CcxRmState[1] & 0x07; Yes. > network->CcxRmState is being fed with 2 bytes of u8 data, in line 1970 (as > seen above). I believe my patch doesn't change the logic of an "&" operation > being performed on it with 0x07, right? It changes the location of the [1] operation to point to a different place in memory from what I can tell, as you changed the type of that array. thanks, greg k-h