Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp240322ybn; Thu, 3 Oct 2019 04:30:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGSlWlu7Qw3SIoeoGG+NYKpgPaHMib0Zup0W/IsY1CH2S0gXZ8rW52Cb7Ikj6ZIkk/ljbu X-Received: by 2002:aa7:c1d4:: with SMTP id d20mr8741884edp.223.1570102232912; Thu, 03 Oct 2019 04:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570102232; cv=none; d=google.com; s=arc-20160816; b=Y2jrKt9Wm2fEpXiU17fPL2hVuFL6H02HOUdjExFcbUt0dy0UGhKFBcSQsj06Qwrrmi 6jsiX7prmB3LJJ1YFgYEW0XDg7WJX87RPHZ0BtJrCUYwQ3lgSwAp9ZP7Z4PMqToKDk6Q 7CzUZHF397RW/JvNYTfmA5OsUvDxSlBDOG36ALbbFdUEiba5LXsq0JQbFB6+eCdhCl5Y Hk5SV5LiacVUWMfe/1d6m7rfvKxfe5prHPNLeG7xEyGyQM4LSjrSMvAGYgYr2WZz4Wa9 VoF4Lq/xM+I1hfZvfbuQpuA59jemtzCAq/LwKtSsiXBGB5AGrM6V9WFUVBgkSlofpygy MtKQ== 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=CnArpqQ0Rg86nep6PgSTZTPcjNou0Dx3xNTIU3N4RW0=; b=B+Vr70klAp2H7QUf/bJKKCOgFRNAzYp7e9y4PHn3rV6t6fadNSOX8eMN8REKu/tf/A y//IMv/1Lyr7hOLQ9n/6YFnriogT0BeijyouNA/RL9JEPaPLnjFzIn6AvMaA/Q1SSr0Q twgOm0hmhV19u3njGBF8EzaSVfqD6dUbqwZIWr16eTz51YEVPpCYKdljrOgpgJY4n6YJ ZDNCzy5p01Bjp7hii3R0jeZKlYb0FjI1e6rLXP9PDgd/U1te9So1FhRLVp7ymiEmQ8jJ ELifkenZtd+C6I0PHPD+FcQYVoQZyqV0htp7LvXIlz3fmNOw15PQIa5PJHZCjImzdHLC 3VBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=R8oBbguK; 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 v39si1332247edc.234.2019.10.03.04.30.07; Thu, 03 Oct 2019 04:30:32 -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=R8oBbguK; 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 S1730018AbfJCL3T (ORCPT + 99 others); Thu, 3 Oct 2019 07:29:19 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:40344 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729987AbfJCL3T (ORCPT ); Thu, 3 Oct 2019 07:29:19 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x93BOXrg118476; Thu, 3 Oct 2019 11:29:14 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=CnArpqQ0Rg86nep6PgSTZTPcjNou0Dx3xNTIU3N4RW0=; b=R8oBbguKb9HH+FJsc0weUTXxVabu6g/gMGHG2TsQ5MbZoZ5VnMLRinuu4UjP+mp+9wgv 9ePY/deQpLu0fMa6eENgKbDqX/y7RV6pKk8YbWr9NSG/GXomy4X/pMPXFPNbiZN6h1BU eDMRWffWunuuvzntI/ePdlg1pFIhAmIMayPMIkYbfFMqOLXKDoUO3zymgXXIlXrJRYD3 rr7uRABrt17e86Rn4OHOhSJk24XDOi4LYOe3K6Dl59ObIicI6oEF05NYEv2PlIdN4Uah Hzm8bBva0cPM6tqUyWr6BPqxRMafUHAW5NtNuMsDHbFdl+XWJ8yb2ld5AhExQmytvJBl Mw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2va05s3599-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Oct 2019 11:29:14 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x93BOAC7184398; Thu, 3 Oct 2019 11:27:13 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2vcg63ej5b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Oct 2019 11:27:13 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x93BRCqm002795; Thu, 3 Oct 2019 11:27:12 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 Oct 2019 04:27:12 -0700 Date: Thu, 3 Oct 2019 14:26:50 +0300 From: Dan Carpenter To: Denis Efremov Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , stable@vger.kernel.org Subject: Re: [PATCH] staging: wlan-ng: fix uninitialized variable Message-ID: <20191003112649.GR22609@kadam> References: <20191002174103.1274-1-efremov@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191002174103.1274-1-efremov@linux.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9398 signatures=668685 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-1908290000 definitions=main-1910030107 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9398 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910030107 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 02, 2019 at 08:41:03PM +0300, Denis Efremov wrote: > The result variable in prism2_connect() can be used uninitialized on path > !channel --> ... --> is_wep --> sme->key --> sme->key_idx >= NUM_WEPKEYS. > This patch initializes result with 0. > > Cc: Greg Kroah-Hartman > Cc: stable@vger.kernel.org > Signed-off-by: Denis Efremov > --- > drivers/staging/wlan-ng/cfg80211.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c > index eee1998c4b18..d426905e187e 100644 > --- a/drivers/staging/wlan-ng/cfg80211.c > +++ b/drivers/staging/wlan-ng/cfg80211.c > @@ -441,7 +441,7 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, > int chan = -1; > int is_wep = (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) || > (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104); > - int result; > + int result = 0; > int err = 0; > I can't see any reason why we should have both "err" and "result". Maybe in olden times "result" used to save positive error codes instead of negative error codes but now it's just negatives and zero on success. There is no reason for the exit label either, we could just return directly. So could you redo it and get rid of "result" entirely? Otherwise it just causes more bugs like this. regards, dan carpenter