Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1724782ybg; Sat, 19 Oct 2019 01:08:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1rqdYoY41oGNs3f9VjPiOpiNxPzmWBo5+SYNe+vG+9EZG8JbhiHBflIQx7kbQnIAxpWvM X-Received: by 2002:aa7:c48c:: with SMTP id m12mr13978913edq.280.1571472499765; Sat, 19 Oct 2019 01:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472499; cv=none; d=google.com; s=arc-20160816; b=Q3bmcnH9et5ivL0UlUkJho8itFLXBCG69zn5eN2DYS4WQQPboQe2NoGLwNebNb35IJ Ohs1MkUfuVBBPhAJ0pSV9E4BT9/p2kBDWd4jCrZvPsNqC5kWFmSYHIsEqojXHJ0bpz4R x3tw0jEcRZi8/3r99JlJfnP+Fau7xJKah5D1FrJe4/LfTjblljU1xI0TeGG32Cfarb+1 RqCAnMXFQdARMOx7S6hBobOY6iZmDQwo6tjZZCkFGydlPgalDTZtu5Hl2UQ2MfpGIvtK R7loiq85shZRSbn5l1h0EPKfErLAa7jKPyJGFuNZfGQZ+KXlewOCLmt0P+ffVLHJ8wf6 0+IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zr8X80FCYGX3NS6q9lz/ERKNDbQdTzcOLi07a/VkvfQ=; b=cFWJAfU3x3fwFu64xrJ3/98CDl8mqekpRUJJE0jOn20V0+pNWoIR5Kt7dW3j7GlZ8m /TxI5EoOrkTVE3TspmOu4C8YP776IByln5I+HTXbl+iuItG7RgG7oVFg3s8EpunNxM4B QNokwNUBLKLxbozt5mc7D3Pwm4Mx8jX27agqag+rqICyzv2XbnwoEdNIEcpuZUQJJNtB 8ekGDHaFjy5G0r/KgnvljToUoeXskvFPrmtN+gu/2NDmv9usruPlXtrA0qNgE5FNYDX1 UfRag7N9AlyNmYoY37KOkL0SSOMBOWBkc/TbhbjTtGfCRYEpHKQn9w7c0lwOvfQv12ET HKzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RAcZMOWD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id re13si4716450ejb.279.2019.10.19.01.07.56; Sat, 19 Oct 2019 01:08:19 -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=@gmail.com header.s=20161025 header.b=RAcZMOWD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391874AbfJRJfD (ORCPT + 99 others); Fri, 18 Oct 2019 05:35:03 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46873 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727917AbfJRJfD (ORCPT ); Fri, 18 Oct 2019 05:35:03 -0400 Received: by mail-pl1-f196.google.com with SMTP id q24so2558877plr.13; Fri, 18 Oct 2019 02:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zr8X80FCYGX3NS6q9lz/ERKNDbQdTzcOLi07a/VkvfQ=; b=RAcZMOWD82a0s6I1gcxzhmBdLU4sVZdK3yGz6Jjs25y3EznSN5eVKpll2358Hrj84u APlxx26N4fwfgRJiFJ3sc5LoxBXcNQRTt/vElvG+W7kkosg66YwJWoZkFCz0xTfMvR6f Cbjd+SgRLI8/CUJ1oQ20/w7/U3I+PL006t8sQWvLz38Yc2tf9QieGrjd592HdCGX69Cg 74loV0t60w65irSxdkjPdEWFSMhshoRMFOVGmFBnebKIMvqsp5MvdTjjjRGoCG0iFtiU h1wO5yRg6ve6/4y64whxVgtn/1JdbbSxx2ZSNWTw0Q0U4by3x1tJ6j6655oXad9I+dDE rJ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zr8X80FCYGX3NS6q9lz/ERKNDbQdTzcOLi07a/VkvfQ=; b=sq22LqApW9FEsoqV0aGahv+YquuRg3W1xSqEhhMXOMX5agYTJQNmmFQOdlSDdhCi0I xKbXIpW27Mgev8H7nnuEVMScEK187JYnDnloD/EGGLmvGIHENDBn84SbQYnCzaUPjQIq IqclwSuVIW6ZVyDxBLNE1V1xQVHDJrLZCw3v/DpLqtKEB6QgspTSaXHo0PCc8HQ5ghgA M39wUSHe2JOJsCCxOYx0GkaAo/bvxtBZ/jw+2luwZmS/BFIo0Rt7q/caJDLUbh+JDb5Y jEoDXjyAu4quiWBwNIPImYbVk+mWcIBDm5JQE4hCghXKBkgBu6vb8KNCOrMkAxZuR4xt WD7A== X-Gm-Message-State: APjAAAV13qLqKf5vpAkBg/2jm2C5/5EA5xJf9EPfGZM9svTPWWpNUtFZ 2XVGAxOBXKbUI/p5LVpoiXxi1L5+qASpDRo0nmw= X-Received: by 2002:a17:902:b110:: with SMTP id q16mr8804423plr.262.1571391302793; Fri, 18 Oct 2019 02:35:02 -0700 (PDT) MIME-Version: 1.0 References: <20191017025058.31528-1-hslester96@gmail.com> In-Reply-To: <20191017025058.31528-1-hslester96@gmail.com> From: Andy Shevchenko Date: Fri, 18 Oct 2019 12:34:52 +0300 Message-ID: Subject: Re: [PATCH] spi: pxa2xx: Add missed security checks To: Chuhong Yuan Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , linux-arm Mailing List , linux-spi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 8:59 AM Chuhong Yuan wrote: > > pxa2xx_spi_init_pdata misses checks for devm_clk_get and > platform_get_irq. > Add checks for them to fix the bugs. > > Signed-off-by: Chuhong Yuan > --- > drivers/spi/spi-pxa2xx.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c > index bb6a14d1ab0f..2e73d75a6ac5 100644 > --- a/drivers/spi/spi-pxa2xx.c > +++ b/drivers/spi/spi-pxa2xx.c > @@ -1565,7 +1565,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) > #endif > > ssp->clk = devm_clk_get(&pdev->dev, NULL); > + if (IS_ERR(ssp->clk)) > + return NULL; > + > ssp->irq = platform_get_irq(pdev, 0); > + if (ssp->irq < 0) > + return NULL; I'm not sure they are mandatory for all platforms. To be on the safe side, you simple need to add _optional() to the both call along with above change. -- With Best Regards, Andy Shevchenko