Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp641785ybl; Thu, 22 Aug 2019 02:35:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqznrh0uu7faM5NJE+JdyB3Ba7jet+l2BfvPQ/ANdjcl1Ax7TPO2JUyGxioT8DmtQvo4IsW5 X-Received: by 2002:a17:902:b413:: with SMTP id x19mr39298510plr.121.1566466524933; Thu, 22 Aug 2019 02:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566466524; cv=none; d=google.com; s=arc-20160816; b=A7WNNlioQVNpASl8ry6Ile82kt8ZDemDWTtD0scQTvZsbhVFMLkJ7DEjPypTej60iG URPeS6aSh3K3P68DSvbsj4OfdE1W0XDQcfjIq6cNqJ3wO/oZo7P1Q4dWcl6m4MFL634k oAMdZysssShQvZ5OhWbrOFpY72jyGQ6SQy8m1JTEzbMU+U40L2cdVBK5nsh9cgVjr5UR xKojelItoPu4x0qaj3veokq1VkQj1lXUH9Lpgw/HF1n14ciBjuSAAqMNL9L0cXRLdnfH H4BtX5DKA88ln1OB5coVna2oIQl31O0FwFMxww23rLaljTsn4BrMxkoMf3XiAaHaYEga Xaqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qys3SBVljwg3jKlIyMl5SvReoKqkq2nisQb3LkrhQDw=; b=gajzgmHmcRB3QSNKmceQImTdFpfYWdX31YbSi9kocGMOfeojp0a5+ApgVLRFlhvfr4 VeYWBils26fvnQpGF718XPI/jyHqpfeIgWaBYtQPa2xU7ouXF5IEAHvw/rPNd44ADK9a aKcf48RFbnCaPr603414BuDnaXjNewQ3cYPvbh9HGH1SIH6Wd/rTwji/K3kl5RdCAV0/ jnJbm8N0pnnk1oKw1DEaNh+mJ9jQAPsroJJvFLrIMG0ri0mvR4viaJaQnOsDPGQm2KTW s84/EgARErebVEEBhMEYHv4XP15jUFJkEgdtwj5VCzQA9TDvKMBWpxytGMX5WhiH1Jpa 1+AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=YBY+JuSI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i18si17851387pfa.23.2019.08.22.02.35.09; Thu, 22 Aug 2019 02:35:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=YBY+JuSI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731780AbfHVIJg (ORCPT + 99 others); Thu, 22 Aug 2019 04:09:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60858 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbfHVIJg (ORCPT ); Thu, 22 Aug 2019 04:09:36 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7M89Ehm064504; Thu, 22 Aug 2019 08:09:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2019-08-05; bh=qys3SBVljwg3jKlIyMl5SvReoKqkq2nisQb3LkrhQDw=; b=YBY+JuSIibdufBFGTGBEgKeO7zKlER3pUamqGDq3xDajOKHNIq5nhzqUBYtVcnhk1RCp Q30fJtYCTPsEzVAlQcHfX5LkylbdSuSfGrlf81F7l56p00v0c/9C50RRUjliblVvDuB8 XohbH+d1fvIHOTImncpt7lWtTDatfNqJueWrUy75E/mpgWzXsockNmLKyM5BJc5k2vlx HKu3PszAXfUJ6uKYFG640vYL6e7yDcIfM1C9hDRe2S3NnpatzFZpecSNLrdKNNGZL0Nb wsJ8eoe1aGOa417n+H1ZcJlNeH9bOR9VGzRQ5IfHsUKD9ZggCqtbKLlASvG3eirBuVx1 kA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2ue90turmf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2019 08:09:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7M88xxL047033; Thu, 22 Aug 2019 08:09:24 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2ugj7rcmw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2019 08:09:18 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7M88s8g016428; Thu, 22 Aug 2019 08:08:55 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Aug 2019 01:08:54 -0700 Date: Thu, 22 Aug 2019 11:08:48 +0300 From: Dan Carpenter To: Colin Ian King Cc: Greg Kroah-Hartman , Jerry Chuang , John Whitmore , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: Added Realtek rtl8192u driver to staging - static analysis report. Message-ID: <20190822080848.GF4451@kadam> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908220089 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9355 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908220089 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 21, 2019 at 07:18:39PM +0100, Colin Ian King wrote: > Hi, > > Static analysis of linux-next picked up an issue with the following commit: > > commit 8fc8598e61f6f384f3eaf1d9b09500c12af47b37 > Author: Jerry Chuang > Date: Tue Nov 3 07:17:11 2009 -0200 > > Staging: Added Realtek rtl8192u driver to staging > > In drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c we have: > > CID 48331 (#1 of 1): Unused value (UNUSED_VALUE) assigned_pointer > > Assigning value from ieee->crypt[ieee->tx_keyidx] to crypt here, but > that stored value is not used. > > 746 crypt = ieee->crypt[ieee->tx_keyidx]; > 747 if (encrypt) > 748 beacon_buf->capability |= > cpu_to_le16(WLAN_CAPABILITY_PRIVACY); Earlir in the function we have: 695 crypt = ieee->crypt[ieee->tx_keyidx]; 696 697 encrypt = ieee->host_encrypt && crypt && crypt->ops && 698 ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); 699 /* HT ralated element */ So the "crypt" assignment is dublicate and should definitely be removed. The "if (encrypt) " check looks correct and it sort of matches what we do in ieee80211_assoc_resp(). 840 encrypt = crypt && crypt->ops; 841 842 if (encrypt) 843 assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); 844 So let's leave it as-is, just delete the crypt assignment. If you want, you can send this patch and I can give you a Reviewed-by tag or if you want I can send the patch and give you Reported-by credit. regards, dan carpenter