Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3070844ybg; Mon, 28 Oct 2019 07:02:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBYGoNoGpiiRzJfi9Hv/0tg0eEmUiZ3qQ7FjYsgic3zIijMD431dozt++pRV9QNcot+IPA X-Received: by 2002:a17:906:488c:: with SMTP id v12mr9365552ejq.290.1572271360922; Mon, 28 Oct 2019 07:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572271360; cv=none; d=google.com; s=arc-20160816; b=dyhWv1QKeklC/LVg0fgKxDwRwhg173TlR29AQxETj0FeRl6UjavPIUwNfVyH15zAhc htwxiEHVT5okd8qfGAnNH7gMvG+tYOJZuyeCjR4mxihYKasTXYbKcJYMj7UZ7ylmRM+/ L9uq5Q+DwptyvmO5jtTv3JyB1wrwkoPi/3GtN5xJr51ntYPGjHZZBUfS9UHJeaeugc3R i/wd6WpnNH1fn23nLmTbd3VatRj2U9PqRKMscLc8pc9NxY/zPHC5HwmtIrzhEw6VmGdo z4NizYy93kSXn0M5YAATREMGKfMp2+T9memyWqSAx1UPm7GkZbxZo4MpfNZD2Xm/I7T8 0lew== 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=zncCQd975Gz2HvK2SjXCCS9OAbsNjkyZCeZT6yaW7zQ=; b=i9X4i6pmSS4gOZCMMs0Z3+CSV1Ub/+UJlx3SZ6V+Cr4zYz6BD6yxB+rg9Mc3tLNTdK s8TOo0nXN79K3kA/cm913Kh9BW7wsrU1zAID0/jF0V0jYG6a/kYRSRbrVg8mCDD4DDew kZnNcmPzzrlexcoEk5fDbCeaL0fqDu74UnexlujFlJXsnsc7eMWj9wOr3JcxiRvVg9Pm B3g5mmYGX26WMUCVa+70nA313OlnzgTjwiW8viOPCLpfErTtWZORdzDU/pObUOnqGr+K m0nngtN+awhpVqalX9StcwiNWCw6RvHjYhC5Q37I4FRYTqf3Z1oaU7MyjMIjY9nbW5XI Y2HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MJFVIuDr; 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 w27si7598916eda.296.2019.10.28.07.02.11; Mon, 28 Oct 2019 07:02:40 -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=MJFVIuDr; 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 S1728119AbfJ1BiO (ORCPT + 99 others); Sun, 27 Oct 2019 21:38:14 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36802 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727028AbfJ1BiN (ORCPT ); Sun, 27 Oct 2019 21:38:13 -0400 Received: by mail-ed1-f68.google.com with SMTP id bm15so6625842edb.3; Sun, 27 Oct 2019 18:38:11 -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=zncCQd975Gz2HvK2SjXCCS9OAbsNjkyZCeZT6yaW7zQ=; b=MJFVIuDrAyz9pDLgpUUl9PU1eZbzKuPQNiEAzcQW1qYjBZjuoWDjrqGy9uWwBC66Cd dI3yEdlYrJi9nlHlHzafl7i8WvKj/XLHxPbDWEtsBpUBMumEUFvInIYQnVTLK+ti+7tO BA7mgqjIeTWS1O1WIN27xKabnFwlPMrDCiIPvQUPLPAq7HMw8gsza012bODYpDuy2/vD taxlG8IqDmUdHTSnMyFv5PMGM92EtSdVF5rDTJo3CJh1YqlOtU4Zj+9HaR42o5jK8e3s jenl27VKb6t9BWfqRxFCO0FEO8G9hJFf5yNF0aRrMh28ErjfYLPp42bc4NbualuBRcp/ eA5Q== 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=zncCQd975Gz2HvK2SjXCCS9OAbsNjkyZCeZT6yaW7zQ=; b=DFGzwfx7yteJn42AglkjGVDhQhojYv2DjzleECKTqc+pztvOGPfEXA2d/5tk0/DXf3 HefSkC8lA/107Ewu5E22Y0uIfSTrESpKRjVSwlgoXCvMW+cgMZ0qdSLfOE+5kLm9Alhm /4MM0aSIw9E3u2qXLBQQoKrrOPbeA3HNcsW5+atPv1nzMQ2/8pZgebnfjEnKzOY5fjOX 9UINNcm0IVC647VWr5Vzm+iavjy+EBhq7MsYZS6DS975daPXxiM+C4Fd/LkwpuosR5eR UA9zAcynxlZDh1L75MPCDbVhvCXK7W7pKxHG4x74cC+PXN++eZDivoxyPJlbCIYylIto fSIQ== X-Gm-Message-State: APjAAAW29Is33njqt1Ai7j8xIc+++cMRXFCaEr5PkdeZyamW+iAz96H+ op0WMfVM4sbGdlkNso32CAYkfylr1hBmYe8yGmaskbsfjpE= X-Received: by 2002:a17:906:1d4d:: with SMTP id o13mr10006173ejh.196.1572226690648; Sun, 27 Oct 2019 18:38:10 -0700 (PDT) MIME-Version: 1.0 References: <20191017025058.31528-1-hslester96@gmail.com> In-Reply-To: From: Chuhong Yuan Date: Mon, 28 Oct 2019 09:38:00 +0800 Message-ID: Subject: Re: [PATCH] spi: pxa2xx: Add missed security checks To: Andy Shevchenko 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 10:04 PM Andy Shevchenko wrote: > > On Fri, Oct 18, 2019 at 2:37 PM Chuhong Yuan wrote: > > On Fri, Oct 18, 2019 at 7:14 PM Andy Shevchenko > > wrote: > > > On Fri, Oct 18, 2019 at 1:39 PM Chuhong Yuan wrote: > > > > On Fri, Oct 18, 2019 at 5:35 PM Andy Shevchenko > > > > wrote: > > > > > On Fri, Oct 18, 2019 at 8:59 AM Chuhong Yuan wrote: > > > > > > 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. > > > > > > > > > > > > > As I know, this is the only one in spi which does not have a check for > > > > devm_clk_get. > > > > > > For some it still may be optional. That's why better to check it and > > > mention in the commit message. > > > > > > > Even if add _optional(), they still may return errors and need security checks. > > > > > > Of course, see "along with" in my previous comment. > > > > > > > Got it. I will send version 2 in which both _optional() and security > > checks will be added. > > Let me be clear. I didn't check if _optional() needed or not. You need > to investigate this before sending new verison. > And in either case this should be explained in commit message. > I have checked this file again and found ssp->clk is used by clk_get_rate in pxa2xx_spi_probe. Therefore, it should not be NULL and _optional cannot be used here. Besides, ssp->irq is also used in pxa2xx_spi_probe. Hence, I think this patch is fine. Regards, Chuhong > -- > With Best Regards, > Andy Shevchenko