From patchwork Sat Sep 15 00:37:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 146733 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1279199ljw; Fri, 14 Sep 2018 17:37:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaTwCATNEPnAU9vgIy7dL97oqOcfekBGw8PKsm47mt4wAeSBOC51GGqfkNwOUx3RcHByMnf X-Received: by 2002:a63:4283:: with SMTP id p125-v6mr13904715pga.142.1536971861582; Fri, 14 Sep 2018 17:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536971861; cv=none; d=google.com; s=arc-20160816; b=JVJdiJDwM8RuH5Tsw1ahzE18/QMprn9Bo6kjXLgqqWDvLF1sglAhdfT7QiJT1iQHv3 yBBqVpKFfJySlqjkFm05pBojqxk4fiujVyFBUO4ExDE5d7NyFZUOiveil9lmybZi/vH0 rRYTw32slUMpXryqHplKlA1Dz5mh4uoMKMjXz5dKW+ZGndy5yTsoBOKkkO8IQ3Pj/SdN PdkNSC/gJSj5uGTEWbqxxjGbGPACP1YlKtTf4/h8rrY/o7Oa6jRG/FYOlu2qI4aoRXPh eMV9fWN3bUmQEIOyc+NQwMwfHE682nj9GfEvIERYxWTZaRF0JKAbpsNJoLNUvYIhQKGI ODJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=v8u+nQm4s2HkguvF0FiGDM58lOA20Cgf/t4d0m1gS3g=; b=rHqk4x6bJIHpUaO1UDcEGoHXSfdvy+b2bJBMSlt2DLlzHIpgwOERkaoESMyZVoipgm TDaoYhgvA0iEgq3tFzpJiInVOIkscvYfv1cXsGgwu67iB7RoSkdBqcJ8r9fs2dsf7kl5 AnkZFo9Dw99DpTqEjRoH7MdH53gID5uH7wtls84FYIEaT7hT/ULTKd1uYKwxA5m44Cl6 qWvpMutfz9ZMcatuDLK08L3ygPd1zPeg4NWhkqYFXFnaUp/22+mrTjZhW3ufGgZnAUEX KYqFDdtaYTEYWN97LcxQ4iDJ9iBMJvl1R1nFRnjj84JBBy85hma16x3io+t9JqdtVADi Zxhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="iS/Mf6Y+"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 21-v6si8751393pgs.520.2018.09.14.17.37.41; Fri, 14 Sep 2018 17:37:41 -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=@ti.com header.s=ti-com-17Q1 header.b="iS/Mf6Y+"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726567AbeIOFyS (ORCPT + 32 others); Sat, 15 Sep 2018 01:54:18 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:37362 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbeIOFyS (ORCPT ); Sat, 15 Sep 2018 01:54:18 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8F0bSMt071587; Fri, 14 Sep 2018 19:37:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1536971848; bh=v8u+nQm4s2HkguvF0FiGDM58lOA20Cgf/t4d0m1gS3g=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iS/Mf6Y+XZG0b+XSCWiS//+/lII24xptKqP3NYRFSNTxVBLQhHMLPTcN5ESs2icVN RZpmKQeVOH3IPgeEluXFnmCR/nz6NWgjw6bLQgCdIGkpjEpETRYd+ewQxNsr9mrkAy 9mMWoZY1xoqtoxiSmiVy6crDOJf7TjHdtwQmMLfI= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8F0bRik023602; Fri, 14 Sep 2018 19:37:28 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 14 Sep 2018 19:37:28 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 14 Sep 2018 19:37:27 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8F0bR7H002128; Fri, 14 Sep 2018 19:37:27 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w8F0bRx13343; Fri, 14 Sep 2018 19:37:27 -0500 (CDT) From: Suman Anna To: Bjorn Andersson CC: Ohad Ben-Cohen , Loic Pallardy , Arnaud Pouliquen , , , Suman Anna Subject: [PATCH 2/5] remoteproc: Check for NULL firmwares in sysfs interface Date: Fri, 14 Sep 2018 19:37:22 -0500 Message-ID: <20180915003725.17549-3-s-anna@ti.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180915003725.17549-1-s-anna@ti.com> References: <20180915003725.17549-1-s-anna@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The remoteproc framework provides a sysfs file 'firmware' for modifying the firmware image name from userspace. Add an additional check to ensure NULL firmwares are errored out right away, rather than getting a delayed error while requesting a firmware during the start of a remoteproc later on. Signed-off-by: Suman Anna --- drivers/remoteproc/remoteproc_sysfs.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.18.0 Tested-by: Arnaud Pouliquen diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index 2142b3ea726e..ce93f4d710f3 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -49,6 +49,11 @@ static ssize_t firmware_store(struct device *dev, } len = strcspn(buf, "\n"); + if (!len) { + dev_err(dev, "can't provide a NULL firmware\n"); + err = -EINVAL; + goto out; + } p = kstrndup(buf, len, GFP_KERNEL); if (!p) {