From patchwork Wed Jan 30 00:11:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 2064301 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CFFE83FCD5 for ; Wed, 30 Jan 2013 00:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751886Ab3A3ALO (ORCPT ); Tue, 29 Jan 2013 19:11:14 -0500 Received: from avon.wwwdotorg.org ([70.85.31.133]:51710 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331Ab3A3ALM (ORCPT ); Tue, 29 Jan 2013 19:11:12 -0500 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 7169663F9; Tue, 29 Jan 2013 17:13:30 -0700 (MST) Received: from swarren-lx1.nvidia.com (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 178FDE4107; Tue, 29 Jan 2013 17:11:10 -0700 (MST) From: Stephen Warren To: Johannes Berg , "John W. Linville" , "David S. Miller" Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Warren Subject: [PATCH] nl80211: avoid "wdev_id may be used uninitialized" Date: Tue, 29 Jan 2013 17:11:02 -0700 Message-Id: <1359504662-23561-1-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.10.4 X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Stephen Warren Silence the following: net/wireless/nl80211.c: In function '__cfg80211_wdev_from_attrs.clone.119': net/wireless/nl80211.c:57:6: warning: 'wdev_id' may be used uninitialized in this function ... by always initializing wdev_id to zero. I assume that wiphy_idx and ifidx are set to -1 for similar reasons, so this change simply propagates the same workaround. In practice, this warning is false, since wdev_id is both set and used under the condition if (have_wdev_id). However, at least my compiler can't be coerced into realizing this; almost any code between the if blocks that set and use the variable causes this warning. Signed-off-by: Stephen Warren --- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 33de803..389e62a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -54,7 +54,7 @@ __cfg80211_wdev_from_attrs(struct net *netns, struct nlattr **attrs) struct wireless_dev *result = NULL; bool have_ifidx = attrs[NL80211_ATTR_IFINDEX]; bool have_wdev_id = attrs[NL80211_ATTR_WDEV]; - u64 wdev_id; + u64 wdev_id = 0; int wiphy_idx = -1; int ifidx = -1;