Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp597069lqo; Fri, 10 May 2024 08:59:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbzaE8+sVHn0ykPw7wIG6CeSAiaAHK8QVZRkz09VDlsfn249RvpHbdtyLcOCjsOU1oWaWTuZWmbEskDoIfkiSfNON7qNq/FWxsUXFKRg== X-Google-Smtp-Source: AGHT+IGLTNGsGrZtbVrW0JntItZeiQ76as5aLPwJkFZTBsA6BHGf+575SOPODd4tCJd600oA5RR5 X-Received: by 2002:a81:ae19:0:b0:61a:b038:6d34 with SMTP id 00721157ae682-622affa8ba5mr33377087b3.24.1715356783746; Fri, 10 May 2024 08:59:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715356783; cv=pass; d=google.com; s=arc-20160816; b=qgKDiPTrkoTfyKllmXt1k+LECr9a/c+vOclM6VVbl/4jCYFa1Js5RzsmA8mDU5vanF 0b+Xhe/OFAEzOPBNzarW68tRtcePco97BeE/cwHpQDA4tAjLV1iF/I2BRYkjyOy26aMp 5ED5ibtYjhDO7cNZdUxDqrJfQmdKqvVX7rNT6n6gjryDAGAPg1ljZTNEJ/3kn6Aq4JCT BkbkxCLjkaHZZ1E98x4gZmnzKt6b5iPBBHrLZ6+7VRG9sgclYy3ktWrs7o4OQ1ukXZGJ e+IlkqEG+nB0sfgxq4myh7qTvGCKPsX7ltUAK92aZbyzHA+zTatkoRUGChs8ogwZCnhj RHKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=kaC1FX9IaWOSYR6DDBjH2nZIpL4z+ve32+mPw2UdL5w=; fh=r9T6QVQDylGn72hy+flJShUNjsHwNqyOy1wYdrZ4qLI=; b=ihXNxiAQSCA6qAqIty5BEfyzaj5uUFARZ5pShtAwQCHpPRxjkGqK3lS0b9SWreJdon 6JdOaw2om+Zs4f6CP/ZvLmlc/lHlcrWOoIOyYNFHeWjTBigqa6yVK5FRoVMFKlHt4n3B GS5bLQ4TC2xcIM+2jjmGKrSCXwHF2LbAs9tXADUevEwO61KCDttw9Y21/492cve9i04T S611rbtMrEx5UDoPP1wOOGJi7xHFXb1KstWQqkvbdggljS+hIQqt2zxN/iFTvdCMN5cn D3qnHAhB+CsgbGPfDsIekqMN/JZc8aVOkqN07nc3zfBS049diQPTJHuNExRigGhNLTPb kNCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PSofYpy8; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-wireless+bounces-7481-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df549d434si36159021cf.112.2024.05.10.08.59.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 08:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7481-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PSofYpy8; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-wireless+bounces-7481-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 56BDF1C236D9 for ; Fri, 10 May 2024 15:59:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3CCE172BDC; Fri, 10 May 2024 15:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PSofYpy8" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DCDB171E6A for ; Fri, 10 May 2024 15:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715356759; cv=none; b=Byg56iNXvVewIsZydMFaGSWPLrb/KrVyRdCIVHf/58Tilblf1eApqlTCJyMk1BxDJLxfi4BoZmr84HPDfHjDeFR7dGHJptubiTzyghUV5ZR1sp4pSEDMTko6HQi1uLH7U8WoNswtgW/27yi2lp9lUgQf36gy6VgrIp60VD0zK1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715356759; c=relaxed/simple; bh=J+92hXnaFjj8CDjvSEIof2zLpu6lXiMuInC1wXs3yNw=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=MQ5Qp6woTl5993GwtTzGwSZHE9sawDOF/Rj1nH33XZFp7X5NnUysT4c6GvTQKoj/d47KRLTwqfpBQmabpoZpiXO6XHVibri77jTF3KTGWc4JWn9jPj9w6OGDXj4ahjjwSxFElzndbGTkLh+d3wh+dJqigKavdXn9eC9dQEwDeC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=PSofYpy8; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-51ffff16400so3680949e87.2 for ; Fri, 10 May 2024 08:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715356755; x=1715961555; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=kaC1FX9IaWOSYR6DDBjH2nZIpL4z+ve32+mPw2UdL5w=; b=PSofYpy8tvGE5zb3ymsZk9L69zp7ezzNQCuG7ObpKZfXzfTeldyQLCfGIuHwu9LhbK 7coOwZ/LG5Xfuf9PE8DQOo5gjG8+YBYLR/XKYk8E+B3MbDsxGyRNWo+tgseMVlockNgw i2SjRnv/tU69R7Kv+s7OBUJhwQaaBjxYDM/07SR15Tp+6PevlTqsEb0RTNfNY7joTAdP EVF62fbV2Xnq36R6V9P1bnwgU+D50J+/9RLpn/h/KGZQ+mik1wWRRl107Jm9q2ir/xcc 4R3jEnWP6ehvfh6JgXLdnzvIijP3DBmU/+uUJZ+H/HZV+QoNB6+dXe7d3JL+GVI1+P4Q YsJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715356755; x=1715961555; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kaC1FX9IaWOSYR6DDBjH2nZIpL4z+ve32+mPw2UdL5w=; b=Lmo624KA+D5xEYdHRZshBrH1DKOc79JLmzatk7jBFcx7J/FqnVkKMMWTTgRtclO0Vb 33tFeIb02glqnatBNSfCP12zC3NBy3D4YzeVkSpqQ3NbtP/v4n4ZqMOSeRVPGfcbvE9A 3zrlEQB4U8xmiaLQlNCJ60+K/v3SmvJ7Gd4cNNN9ou5bkUvs1DSCz5CSWY/3wFvxVYKv 6Kl+P4KbH4mUI9dYPwoqJTXjy88BlM1TVYGjac5xXGyFiKs+Gb2aJ0+gOfAR2zsIskoA TzOtIM37eZak5FOkPgC/9/4NLXUQ8Rg1WdUfYBTGw04aY7PfCcKFntc7yj04mpykaKa7 6VnQ== X-Forwarded-Encrypted: i=1; AJvYcCXCEV29gYqXX83kmsZYIIdtjlBJOKvKv+yoL0ZNsxVZh3AkASnc67NOBxlcYhnxc128vmcxXKG37OYegMuSYJ7/ZAzwed8jt/47aBODEX4= X-Gm-Message-State: AOJu0YwJ3MsmqLOn7BZiKZIL45/ix6ziNrsh1fPcOw18ZPzTfHasS0Dd P5dCVtYMVDa5SmghZfJyDrwE+cEsZjoSc6PdPgs+PaNiqAVPvkk3HwBbzVP54C4= X-Received: by 2002:a05:6512:4003:b0:522:221:d19d with SMTP id 2adb3069b0e04-5220fd7bfccmr3137814e87.15.1715356755115; Fri, 10 May 2024 08:59:15 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17b0125bsm199199366b.143.2024.05.10.08.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 08:59:14 -0700 (PDT) Date: Fri, 10 May 2024 18:59:10 +0300 From: Dan Carpenter To: Miri Korenblit Cc: Kalle Valo , Johannes Berg , Gregory Greenman , Ilan Peer , Dan Carpenter , Avraham Stern , Yedidya Benshimol , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] wifi: iwlwifi: mvm: fix uninitialized variables in debugfs code Message-ID: <466baaa2-4996-4193-b681-d847d181a961@moroto.mountain> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding The sscanf() function doesn't return negatives, it returns the number of the number of input items successfully matched. Fix the error checking to avoid some uninitialized variable bugs. Fixes: e5bf75dc46e1 ("wifi: iwlwifi: mvm: add a debugfs for (un)blocking EMLSR") Signed-off-by: Dan Carpenter --- drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c index 17c97dfbc62a..88e78c798017 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c @@ -762,11 +762,9 @@ static ssize_t iwl_dbgfs_esr_disable_reason_write(struct ieee80211_vif *vif, struct iwl_mvm *mvm = mvmvif->mvm; u32 reason; u8 block; - int ret; - ret = sscanf(buf, "%u %hhu", &reason, &block); - if (ret < 0) - return ret; + if (sscanf(buf, "%u %hhu", &reason, &block) != 2) + return -EINVAL; if (hweight16(reason) != 1 || !(reason & IWL_MVM_BLOCK_ESR_REASONS)) return -EINVAL; -- 2.43.0