Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp73807pxa; Thu, 13 Aug 2020 20:04:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQC91ewT6CgZxdyEdiq9srMx28JKVEzejCcYUgSgPu4gG4ufIWNWUI9SUD9NvRipZd0zxh X-Received: by 2002:a17:906:e289:: with SMTP id gg9mr520489ejb.448.1597374294161; Thu, 13 Aug 2020 20:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597374294; cv=none; d=google.com; s=arc-20160816; b=tzA4kn7a83bkkM7rck+bQYgId9pE9rvXGiQO39K14Fc7SpoON4pIh6xr3ywRvuL0ex FBaWA0iB8sIfY0nWYRfNVU7d7Xoegw3EgwLbsRnC4wbSBW+TS7nS3cVbzpvuahXZHsU9 IePtfG2NrJC9qtg6xCwUie04f+UFab2OLiqTVTz3GosLJeWr4ElKox/MnEJoXPdwXGEv ETheTEeQ5Q0CzcPfDXBc4LJaXmDW4XEHgsfM3kTZAFYRZp7O2tBixhEJJWyv328X2GXc IYndcyZ4s/A/QyeT3N+k5tefZ71aM5sVzUIcxyMifTJrtCEaNhC1Rvv8VFLE4uhm9/FA qTow== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7KLfIVMRwqpdC47NwuYFPGVwE5g0uXxr3Mm7EIshdF4=; b=0wWHn9lJv0sUeiMbfVpUhbcfZuhO3/fJqlMGPiVXZ+qmKkUPVxQWKgnqzGx9xvHw1k g3QTKk4bfIT0eKXTUUCr7yrVmQ3t0OFv+0ErYxeC//+M5b25WJY0XPuHnTA7763dh5Fe NtRWwfYdgGcagzku+iJFEi0VEGJPJ6bicAcALYUTOVYXLPO+vMyFfD5F6sQvO0cvBqlr WYaz0QCdXzEoRO3uGEwc7MMZGJCQWu1rrvbPQiUFndR9l5jGWZoUHcYVIFGvqQaRD3xf yo6zE54eXbsbkh8RYdLMR2hD/MjOkoyrdJXNEoDA0hBpBE0LuDwfOpoo719Mpo8ufJO/ gn/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XGIbA/8K"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id g12si4702335ejr.622.2020.08.13.20.04.25; Thu, 13 Aug 2020 20:04:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XGIbA/8K"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726696AbgHNDDZ (ORCPT + 99 others); Thu, 13 Aug 2020 23:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbgHNDDZ (ORCPT ); Thu, 13 Aug 2020 23:03:25 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30076C061757; Thu, 13 Aug 2020 20:03:25 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id f5so3535234plr.9; Thu, 13 Aug 2020 20:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7KLfIVMRwqpdC47NwuYFPGVwE5g0uXxr3Mm7EIshdF4=; b=XGIbA/8K9NTQaOueUYCKV8UkHhRRSZR91/IkYRMh5jiuvYuHA3yQK5/gfLjAPtn8iv C4nk0l52EE03npbsCcb++oZJcODW97Zpu3hrDRumyoQcPx8QF5W6HBRl1V+X2HK0Rk3Y YRvofG5uNysBGozU2Gwn1yykJ25p/fdme7dq3d2+mdqFLSQnhmnmNq+YQ0zRH94d+juw tl5M0dRB2fqlKWIEKguabnlHgxVa8+qXfa9q4J1NqEvRtcRxkXjd2Xm+VxgX+I6202ve 2nyBXsZh5b9iv1mSDxo2u8TMZ/6Dj1ro+rc3hTdSflfI9LCLDw/zYkw9jWpJjcZQ58If ucrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7KLfIVMRwqpdC47NwuYFPGVwE5g0uXxr3Mm7EIshdF4=; b=FVJXqplufl77TwQWlz+n6XCxhtznkT3egWCedxBZlLUoRx3zD2gaLop4K6Kr2Rm/e6 bp+30j+QT80cZkgdz3/nrrJFd+gdMXnu5cNInkrFRg1S+RmNp/ckId/egeJtaNaSHcWM ESbKcjchyKXEmDVq431Cw647c4I/+Y3eFyhuY8WUMHMAQ6AgCtWdmiuQrwqV5YR2nStQ N8YGG8rIyVtEQDiNZ28gvwGkDFbhywdbeYgIasY3y2URdFOBAsvCpwOnU3B88sWW7AAN p6JmxIpUpSi9ojngSFbs2J8NsoeETdmJV1Wv7uWJVjAg3mRLkuQMOIDdB7puz793/hVI /9fg== X-Gm-Message-State: AOAM533rJ7qsclNwXPI+oVbIBXFbR6Tx0xO/HTUzy1bB/U+MxpP7EuO2 W4LqC94O532OTgsegyvnr3vrmQCS X-Received: by 2002:a17:90a:b88c:: with SMTP id o12mr551819pjr.187.1597374204406; Thu, 13 Aug 2020 20:03:24 -0700 (PDT) Received: from sol.lan (106-69-161-64.dyn.iinet.net.au. [106.69.161.64]) by smtp.gmail.com with ESMTPSA id z3sm6522231pgk.49.2020.08.13.20.03.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2020 20:03:23 -0700 (PDT) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linus.walleij@linaro.org Cc: Kent Gibson Subject: [PATCH v4 01/20] gpiolib: cdev: desc_to_lineinfo should set info offset Date: Fri, 14 Aug 2020 11:02:38 +0800 Message-Id: <20200814030257.135463-2-warthog618@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200814030257.135463-1-warthog618@gmail.com> References: <20200814030257.135463-1-warthog618@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the value of the line info offset in desc_to_lineinfo, rather than relying on it being passed in the info. This makes the function behave as you would expect from the name - it generates the line info corresponding to a given GPIO desc. Signed-off-by: Kent Gibson --- There are some instances where this results in the offset being set when it is already set in the info, but I think this is clearer especially considering that, as part of the replacement of strncpy with strscpy and to to ensure kernel stack cannot be leaked to userspace, the info is zeroed in a subsequent patch. drivers/gpio/gpiolib-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index e6c9b78adfc2..e95e3eab9867 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -752,6 +752,7 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc, bool ok_for_pinctrl; unsigned long flags; + info->line_offset = gpio_chip_hwgpio(desc); /* * This function takes a mutex so we must check this before taking * the spinlock. @@ -933,7 +934,6 @@ static int lineinfo_changed_notify(struct notifier_block *nb, return NOTIFY_DONE; memset(&chg, 0, sizeof(chg)); - chg.info.line_offset = gpio_chip_hwgpio(desc); chg.event_type = action; chg.timestamp = ktime_get_ns(); gpio_desc_to_lineinfo(desc, &chg.info); -- 2.28.0