From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F3BBCA9EAF for ; Mon, 28 Oct 2019 01:38:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 495112070B for ; Mon, 28 Oct 2019 01:38:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MJFVIuDr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728149AbfJ1BiO (ORCPT ); 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-Google-Smtp-Source: APXvYqzgnaDiUcH3IYDfQVBOpeExgcPu32wDgAZkOKAPutypEopBXKs6avGlVlBxf+yhnsEi3FfGHSOF7QMkbQk2/Ug= 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