Received: by 10.223.176.46 with SMTP id f43csp2932475wra; Mon, 22 Jan 2018 05:56:24 -0800 (PST) X-Google-Smtp-Source: AH8x225oMH8AEsHhAVr+oHJZnNSm6sOgWat9k8DLl3K4L0b5ZJt7ZaSEncQLaO/puM25DyZRBAGL X-Received: by 2002:a17:902:2c43:: with SMTP id m61-v6mr3768877plb.189.1516629384424; Mon, 22 Jan 2018 05:56:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516629384; cv=none; d=google.com; s=arc-20160816; b=lB0zSqx0d1LXATVbt2TfPqtPPgENB5JUoGl/TIvQHX3EGEeXTFNmP2k/4Fh4aSLeGQ 8Dp0v1RrumEiVxold023P8JNF0Z4U8cneIOvrnGs792ZefoIKN94YY+cMi/JYyZ+nt0K xIqQ3QCf7ov50Sm90pMi0KBTSRh4D8QSXw0amNWo2w1eqRad+dpzNi59rqaXkujmTc99 DB5eFHFMyg8KjMwVdYDqL2S9xKxB5nVWNj8qjo/cWtYphhDdESfA0N2sywrf0OIAgmUi QGFwpJ4pp+OYVYgiuYmArz+iEb7yryirBo1a+7bFPtMqkf3I3HM76HiWWZiZrmQXBTR9 540A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=QJwxmP3f0PgmOS9xHtI7JyqliJVRCIyzIh0asjkjtb4=; b=QoSseQ8TBsZiFrfWbUKlzr4fjGwFQcadCVBZG5eHZRAXZFRSYuHLthFaOdE58RKC0T 80nqa+C1+CGbAn5aqiHzm4yq5rqJiBlvvuZZSAFSA9+Mp0GkQO4UAMaoNlFU6a5KnFkn pxz8M94oRLjzgRGaadyvM1gHK4WSWsvB4SrWJrPYCP29J94dTKfAf6KkoMozixbUWBH4 0zUsFK2SzIF0tmyri1OrwAaPvSXw7yLHVicIiZ/Fuph+MPMldOPKkE0AJP6ZY5VZYFoV fiCTnScGqFm3PD48ycU01UKIu20/X33zKOlrGjMz8g7UU+i12srT1FEaby74GybCwJNE Lp3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=FuMYbnJg; dkim=pass header.i=@codeaurora.org header.s=default header.b=FuMYbnJg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s135si13799912pgc.165.2018.01.22.05.56.09; Mon, 22 Jan 2018 05:56:24 -0800 (PST) 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=@codeaurora.org header.s=default header.b=FuMYbnJg; dkim=pass header.i=@codeaurora.org header.s=default header.b=FuMYbnJg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751124AbeAVNzq (ORCPT + 99 others); Mon, 22 Jan 2018 08:55:46 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:57448 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751004AbeAVNzo (ORCPT ); Mon, 22 Jan 2018 08:55:44 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E70166079C; Mon, 22 Jan 2018 13:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516629343; bh=fYcZkfYDzpdpva3u16PoAsbxSVkZ6oYCJSC1j+xNPI8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=FuMYbnJgepdPV+PZpbsEWaEDz0mHmNAq/o0zyRRQ/7Y+0rjsn+B/xaj/Mr3aUb0lP N270t3OrvevCyBF163eh8G9pjGCMGdkaQ3myZ0XMxT6prDLOXzPkxRg2RpNCxTCsRo BrxNzQ12P1j6r3EBpVB9waZLBFRW0wbfUpFobB9Y= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.1.125] (cpe-24-28-70-126.austin.res.rr.com [24.28.70.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: timur@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9F0286074C; Mon, 22 Jan 2018 13:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516629343; bh=fYcZkfYDzpdpva3u16PoAsbxSVkZ6oYCJSC1j+xNPI8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=FuMYbnJgepdPV+PZpbsEWaEDz0mHmNAq/o0zyRRQ/7Y+0rjsn+B/xaj/Mr3aUb0lP N270t3OrvevCyBF163eh8G9pjGCMGdkaQ3myZ0XMxT6prDLOXzPkxRg2RpNCxTCsRo BrxNzQ12P1j6r3EBpVB9waZLBFRW0wbfUpFobB9Y= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9F0286074C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=timur@codeaurora.org Subject: Re: [PATCH 3/3] pinctrl: qcom: Don't allow protected pins to be requested To: Stephen Boyd , Linus Walleij Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andy Shevchenko , Bjorn Andersson , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org References: <20180110015848.11480-1-sboyd@codeaurora.org> <20180110015848.11480-4-sboyd@codeaurora.org> From: Timur Tabi Message-ID: Date: Mon, 22 Jan 2018 07:55:39 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180110015848.11480-4-sboyd@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/9/18 7:58 PM, Stephen Boyd wrote: > + ret = device_property_read_u16_array(pctrl->dev, "gpios", tmp, > + len); > + if (ret < 0) { > + dev_err(pctrl->dev, "could not read list of GPIOs\n"); > + kfree(tmp); > + return ret; > + } Just FYI, I'm still going to have to parse "gpios" in my pinctrl-qdf2xxx.c driver, even though you're also parsing it here. That's because I need to make sure that the msm_pingroup array only contains "approve" addresses in its ctl_reg fields. + for (i = 0; i < avail_gpios; i++) { + unsigned int gpio = gpios[i]; + + groups[gpio].npins = 1; + snprintf(names[i], NAME_SIZE, "gpio%u", gpio); + pins[gpio].name = names[i]; + groups[gpio].name = names[i]; + + groups[gpio].ctl_reg = 0x10000 * gpio; ^^^^ I do this because I need to make sure that "unapproved" physical addresses are never store anywhere in groups[]. That way, it's impossible for the driver to cause an XPU violation -- the worst that can happen is a null pointer dereference. -- Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.