Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2682674pxb; Tue, 23 Feb 2021 12:56:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzL86czrPRQpzz+6x2frKmw5viJX+koCTr4DS1uQvQec2zTZxh+AC9nwV8LCjA5Ep2sa+9b X-Received: by 2002:a17:907:9802:: with SMTP id ji2mr7913184ejc.134.1614113768986; Tue, 23 Feb 2021 12:56:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614113768; cv=none; d=google.com; s=arc-20160816; b=SX15K/deD8gYzK3xKQ5E7Nl/M/NN2eJOOf06hi6c0wnzelo6k92MTzlPP+vyMEXKCZ s0O6VMXgoTikGMyc8/sWVg28eBhp1XFlTczYJTl0IilxH+SUrcCyPnacBZ1IpT0My2wX FSNi5TSR4J3KHSAsDmL+jCMB2SwMKATpYaaJxy8ADeHumeH77Q7dT1o4bzcwao5T8104 5zKJpYTB4XcTyERw5AB5ZYID7sZDvCbnjPwBDxcRvhDuNg+3zyYiyPhe3hid3rJm2Rb+ joc23NGZKRCFNRbUxQv0NSqN2f18RXGeNhnaAatEFHRR2HAYDBOFgMufByOpy6kEUF4S mrxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Q5g0X8+sVSveFroJjg1Oe6VYsVSwESFscNmYOxJrFSg=; b=FmuwlKVC/W345vjnRZ8Rv5flxxrNMSII35YfUf8EgoWsGlxmFn/PsdHxpnaCOti6mv anVDRwb9O1s4XZBJhEpNVNc7DRCjrLhMeDj/HBbEOjNLPX3BTuSgl5qrljzZ8UNY280t T9i88HC6o2DX6DJKoI+VcGwQwhC9zY+KxGEViI9g0dmrBUSQLKRYvvOQQmtNjeej09TU YHTKJiiaGRtCUdvmoLGEPNJ7GxLLvbvOrQii0YVMrQZfQpy39M40qgrWke/Wh1Jr+y2L jDfoLe0TOB+dO0nG8F2Xpcs2eW7BnUEXR8aIfx1iHhdQ5Zua2iYUD7Hp0a0zasPuk2Ee bHgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si2028678ejc.368.2021.02.23.12.55.36; Tue, 23 Feb 2021 12:56:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbhBWTxV (ORCPT + 99 others); Tue, 23 Feb 2021 14:53:21 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:43422 "EHLO mail-wr1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231719AbhBWTxT (ORCPT ); Tue, 23 Feb 2021 14:53:19 -0500 Received: by mail-wr1-f53.google.com with SMTP id w11so1131617wrr.10; Tue, 23 Feb 2021 11:53:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Q5g0X8+sVSveFroJjg1Oe6VYsVSwESFscNmYOxJrFSg=; b=foYT59CZ3O/WhuP/TS/QvYO0uCgVfLOU+4SgL6pBmTySXk5Dctz6kJtGDgDPyjZwLR He4raVuGpGluBXGwJHBMHRC8fNyAwFylsmYwC6kEX7uBByudYQKUUK8CrgtsbKXg7ouG t6hzCbyUlGLQjCRuXe73KGr6C183LeoI0ffs+gyS1VlsfyOG8SGYrROMz0j8R/Ts7b/U 1Je/4lE4nWQObtx1fDwdke/6YdfmK1WddKOA7hnBtBSR5wMQbHCYSnezclBaUkCvaXIO Vkc4SMsJQIq257+VtmddvkJeVoIQaR6so0G12YVdRVq4hiaX/0FSFqWkYKABCrLYViS2 Ge2Q== X-Gm-Message-State: AOAM532WRgmwA8aSSXsIN49u1PmuxkR3jzHf+CV5K2NfneJwIThhDABs Mne0xdWC6MDIv0T2oDBR8Bs= X-Received: by 2002:adf:f750:: with SMTP id z16mr25990808wrp.108.1614109956949; Tue, 23 Feb 2021 11:52:36 -0800 (PST) Received: from kozik-lap (adsl-84-226-167-205.adslplus.ch. [84.226.167.205]) by smtp.googlemail.com with ESMTPSA id h20sm3713924wmb.1.2021.02.23.11.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 11:52:36 -0800 (PST) Date: Tue, 23 Feb 2021 20:52:34 +0100 From: Krzysztof Kozlowski To: Colin King Cc: Roger Quadros , Tony Lindgren , linux-omap@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memory: gpmc: fix out of bounds read and dereference on gpmc_cs[] Message-ID: <20210223195234.cqird4txhokvbfjj@kozik-lap> References: <20210223193821.17232-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210223193821.17232-1-colin.king@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2021 at 07:38:21PM +0000, Colin King wrote: > From: Colin Ian King > > Currently the array gpmc_cs is indexed by cs before it cs is range checked > and the pointer read from this out-of-index read is dereferenced. Fix this > by performing the range check on cs before the read and the following > pointer dereference. > > Addresses-Coverity: ("Negative array index read") > Fixes: 186401937927 ("memory: gpmc: Move omap gpmc code to live under drivers") > Signed-off-by: Colin Ian King > --- > drivers/memory/omap-gpmc.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) Thanks, looks good. I'll take it after merge window. Best regards, Krzysztof