Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2795709ybl; Thu, 19 Dec 2019 21:41:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwS5m4/TTj6Ngf69t6Y3RoWEIwztUje40koueQ2onWAVIeXC0VRXhoZJv4ThmLqN8D8YMt+ X-Received: by 2002:a9d:f26:: with SMTP id 35mr13724215ott.260.1576820502825; Thu, 19 Dec 2019 21:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576820502; cv=none; d=google.com; s=arc-20160816; b=hb4BeHr8LGyhi5udlsIwseezubNdk77PPnXAg+Wyelf2Mq+pQjLNEhc/vm8pl2O88c 3+0w7n6gkLe30pkabpdQf7iGWvWfaXjBfywwWh09WJsfOpSBj4xFci7xKRo+v3jTvh5o lHp16rCUgHLRWT6V2co/sDXJTfGbCnh51L1cFzexgj2dDr0krELoQARHO48QldaeuoiD nhto+KllKC1KsfibsYHobs2zJQebkxn0q/Fh2zZsyrvcGvALuqaB4pk7qm8L5jQMt6iQ p2xsQsN4pAgee0YtcP28b/EcP/Sv6TkCMgL4hhPnLGNH8r4OCLoehefRUpa5ekHq2WXY bp9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=4GeBcf5JF4zfiKnVvLepo0vQ+2L/W2VOfoUnSqA0Nbg=; b=JYUqC1Jo/m/X7OWuvRHdkcAoKXLKQBCxwUZtIu0W77k/5f5zuarI/77hfDb3x86COF t53wm7t1lIbQe0V+WmWgRBq6m7cGYgp1KnygDYxPZm6VBGg3044W+P+3UDRAWC+LFg2/ sGq/uhMlc9zfYhj88i16A2SwkERMlYyW0UYTXvLE8Br9qnqFZlRlm+hmAkGbVHwOl5Pq fm57MTSM6Vz+Av1/GtOxi5O0phy2YlmYFxPJ8xr9AL46CAt31Vf1hjkRaAQdAm8h74vg Y2gEFFMkiEmyDdubysfpsRWCq/+i6/reEUfQ2mftnFS7OkB5ZVu5bpgwxiY+tiXJdHB5 /wmg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16si4430840otp.198.2019.12.19.21.41.29; Thu, 19 Dec 2019 21:41:42 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbfLTFku (ORCPT + 99 others); Fri, 20 Dec 2019 00:40:50 -0500 Received: from mga07.intel.com ([134.134.136.100]:63509 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbfLTFkt (ORCPT ); Fri, 20 Dec 2019 00:40:49 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 21:40:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,334,1571727600"; d="scan'208";a="416433124" Received: from ipwrosz-mobl.ger.corp.intel.com ([10.252.4.56]) by fmsmga005.fm.intel.com with ESMTP; 19 Dec 2019 21:40:45 -0800 Message-ID: <21328530d3f15c75abca8107823a4578e5065ca6.camel@intel.com> Subject: Re: iwlwifi: refactor the SAR tables from mvm to acpi From: Luciano Coelho To: Colin Ian King , Johannes Berg , Emmanuel Grumbach , Intel Linux Wireless , Kalle Valo , "David S. Miller" , Ihab Zhaika , Shahar S Matityahu , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Cc: "linux-kernel@vger.kernel.org" Date: Fri, 20 Dec 2019 07:40:44 +0200 In-Reply-To: <18ea9fa8-93fe-f371-68ee-3d12eac252c8@canonical.com> References: <18ea9fa8-93fe-f371-68ee-3d12eac252c8@canonical.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.1-2+b1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-12-20 at 00:02 +0000, Colin Ian King wrote: > Hi, > > Static analysis with Coverity has detected a potential issue with the > following commit: > > commit 39c1a9728f938c7255ce507c8d56b73e8a4ebddf > Author: Ihab Zhaika > Date: Fri Nov 15 09:28:11 2019 +0200 > > iwlwifi: refactor the SAR tables from mvm to acpi > > > in function iwl_sar_get_ewrd_table() we have an array index pos being > initialized to 3 and then incremented each time a loop iterates: > > for (i = 0; i < n_profiles; i++) { > /* the tables start at element 3 */ > int pos = 3; > > /* The EWRD profiles officially go from 2 to 4, but we > * save them in sar_profiles[1-3] (because we don't > * have profile 0). So in the array we start from 1. > */ > ret = iwl_sar_set_profile(&wifi_pkg->package.elements[pos], > &fwrt->sar_profiles[i + 1], > enabled); > if (ret < 0) > break; > > /* go to the next table */ > pos += ACPI_SAR_TABLE_SIZE; > } > > So, each iteration is always accessing package.elements[3]. I'm not sure > if that is intentional. If it is, then the increment of pos is not > required. Either way, it's not clear what the original intention is. Good catch, thanks! We'll fix it. -- Cheers, Luca.