Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp850626ybi; Fri, 12 Jul 2019 05:41:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxpwh8EPSCY4YFbynNIxMzyCWWg+RTuGtgOIXTwzIrvobOXLoKdUeU5V770ngWBkOVNlpI X-Received: by 2002:a17:902:9004:: with SMTP id a4mr11326668plp.109.1562935309271; Fri, 12 Jul 2019 05:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935309; cv=none; d=google.com; s=arc-20160816; b=JbxIoBk7gz94V0kN8pQHR21MzCt54tNfAVtsMChpIYCshgcpqZuE2ALrMKNfYT1Os2 XDH6MeE2YfnooWFXF5+r3oEE1d3HnAOx2+W/rDj9PALYY4FrmEKFVWP9bCmVlwMTV5iZ ySHDl8dbgY7H3254VWIaB132koeO4Bwd/v1+SUooeG0nK4U+MVyvn6RK2tYBK+jy9l+u mKWQM2t130EpOkLt/TysRoy6irYNA/TkeyDJT0GsCxG1buov0wKH1jB7FoaSgXZmabpq KQuCyHgLBgR9uHG9gQXe0GNPBjZ3OujB0FXoknhrxTay/vMwkgJjp5qNC33U98a/4bZB OctQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xik36tO+rMe6AZZExaAVL78449SHco75cYokBLt53J8=; b=JA4ULv4oVjH7hchoV8/SCIjvsO0IwsO62sLkg9N19uEvtAVxc+IBlJEGKagxVhFqH9 +wMwylpFmeREpjSAH8wALxTkHu/yIhHDJVdlgKk2UdHtlXUqNmwyyT1mH+FM8Sa7XYh3 VxYroXbOzuoNui/geuqSPnR4HVvwtKh8WP/aPoj6FV1sMRsx0LRSt0u2kKFCuCVS6NrT ikrgzqNq0uuoegsERrJ/4uEB3FVeEoWH6DV2cxczMaS9gmVyst9azcVQ9iZv7NFWxVhQ T4GSlsD46okY5HFvZdoJSrsnvw61Ux5ZdxJN9d3/hYCwjhwHyfCwmUdhbTTQWFRR2NTn KCwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="YoXe/Ry5"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si8016856pjo.88.2019.07.12.05.41.33; Fri, 12 Jul 2019 05:41:49 -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=@kernel.org header.s=default header.b="YoXe/Ry5"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728258AbfGLMkc (ORCPT + 99 others); Fri, 12 Jul 2019 08:40:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:35254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728259AbfGLMZU (ORCPT ); Fri, 12 Jul 2019 08:25:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CE88321019; Fri, 12 Jul 2019 12:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934320; bh=DDcxO7wSGYZlws8b7PBLpP2BhHVd7B9Pkx8sqcmCuvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YoXe/Ry53tBk0qJmlvXmTpQP18NfqOTWaMyfwdHLhutsqnyOD1FrXI/AOHCG0RVgF jcENg28mMWgzhx2bsK+AjsYBG07/fGKpojxnqg30WZM148ED5/JmwMl5tAOy8oM0iI /vPcs/ImtZjSW5Th8/HRTmPXGvByI/smIa3S7xgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Pierre-Louis Bossart , Vinod Koul , Sasha Levin Subject: [PATCH 5.1 017/138] soundwire: stream: fix out of boundary access on port properties Date: Fri, 12 Jul 2019 14:18:01 +0200 Message-Id: <20190712121629.380616400@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 03ecad90d3798be11b033248bbd4bbff4425a1c7 ] Assigning local iterator to array element and using it again for indexing would cross the array boundary. Fix this by directly referring array element without using the local variable. Signed-off-by: Srinivas Kandagatla Acked-by: Pierre-Louis Bossart Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/stream.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index bd879b1a76c8..00618de2ee12 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -1401,9 +1401,7 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave, } for (i = 0; i < num_ports; i++) { - dpn_prop = &dpn_prop[i]; - - if (dpn_prop->num == port_num) + if (dpn_prop[i].num == port_num) return &dpn_prop[i]; } -- 2.20.1