Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2287246pxk; Sun, 27 Sep 2020 02:02:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd2Qk5LCyNQcNVFbdd+CriXHZKUpE7KfTkp3J5tvv0QKXPg5LEHVAmNmKAYnvKYIQwZ6eS X-Received: by 2002:a05:6402:b9a:: with SMTP id cf26mr9844242edb.375.1601197330788; Sun, 27 Sep 2020 02:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601197330; cv=none; d=google.com; s=arc-20160816; b=ir2tlu+r7G7Tsu+9SH6pi6k/2Tz0T2B69gI8sfYJdQy37+7L87Rr2t5m2pblidcpX7 rFmnYD1lE0yMQfBNR0cY834BgSyAws66q0Rt4lTnLObKG8ihh8h/rq2QEC6yE8bW3c6f KH/kbocRtGR2yRJR7b6z2/rlbRzTqhlNONry0zPxBX0n0hHEHWSLZjD9H7PRtyotgzLn 3rxEJLpj8RObo8YUb4zQpsd8hrf1s9Io4C4e7uprKf1nvDosJ/nq5uxgJO9X73nw7Pco ndfxbFC9yYQhEXiSl0xuJLHl41Hz9+TTAeHaGT6W/D0ts/egf0tX4rLGzPO3IGtdxsGc Ordw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=CsSe/NAg5hh5twY2laF9QNcOoA0xUfMrAX8MspdptgI=; b=JXwn3onFxClXTdFUbranjpxlRH0QYICQgg9K8bZDVzR1QbRt8dg07k6PoPTe7UWHDW r3vOG1WAt+jdc9RiTZu8MVyjLdgHVUTtWFXEM2URNUECypzB+wDW6tFrn5M6JRzCXeUl IKwjND8I57UNX5qcmDlAe/G85+qCy5IqItpEJLxo7pgzNVj3kyZRv2froB0zXEWY53v/ 0CL8FRVKylhv3s+DV0nNiqtDObTzs2qIdIyoxLmVNSsjJ6frVpJRvuWYi4nPhbRa8A2F /uoGc5ECpfLie7a0QxEmeR0Lv2xY7kfjV7u786r8dzfsHJu5UG3xRu1PkNvBIh6RZ7Em t4HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="hkJ/SodC"; 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 g23si5800249edv.304.2020.09.27.02.01.47; Sun, 27 Sep 2020 02:02:10 -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="hkJ/SodC"; 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 S1726321AbgI0JAV (ORCPT + 99 others); Sun, 27 Sep 2020 05:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbgI0JAU (ORCPT ); Sun, 27 Sep 2020 05:00:20 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF39C0613CE; Sun, 27 Sep 2020 02:00:20 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id x22so6676571pfo.12; Sun, 27 Sep 2020 02:00:20 -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=CsSe/NAg5hh5twY2laF9QNcOoA0xUfMrAX8MspdptgI=; b=hkJ/SodCjib/LnmfcsGJgIp1rS5IstgJRpuMC4FofLP21ppfFMtHAQwo5mLBnAacmK hceaeaDS0aHMfFgsO9saMdH4W5WVPo0Cjw1BlzZrPRkuTLCBXJVYup75/aCH6wsRkAYe Gi1NG3gfhFnKPcjpuvgq5JKil/P42YbZ3rarQTXeM/Y4GzjDU1SOLiex3Bh1UsayBuCV O54m2DrnOKnt+AyzbCnsML3qgXD8qp+T9fznUVEGoqjVW1h4RZ+f3l/1OWPPXI/g5pt6 9BVzqtm04SWJbPvSToG4KyLgQnxwFKmruR+3O+mnCYfnE4S7gVjKA5qglji064uVJLIR mZIQ== 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=CsSe/NAg5hh5twY2laF9QNcOoA0xUfMrAX8MspdptgI=; b=AFkteUSJVxsql0L9uWcEYKeEWUh3qMfOPFATooTTujNpexuORcEobxfMEN1+gYQDai tscHkApB+8T8iFielmqGEuQC54swHyJv0gMEbViY45sqVL7QErNMgq753K4Y9aVUJ0cP 9zyGz/SBTD5wDAq5q2I6hqwvvGgsuYSCGA9OrvSbfBn3oHf9bnKAYjCdumsOkkZW/X1L FDSBL9Sxo6zHkjtEqpJ1t2g2YicrtCzgS/vKrHQ2t3nM23gjoSJJMYe9ChXr5uZncGvF qUaI3dHm/WW3n0WHVrnPqkXgSuhb062jSZeyAV/h9g7761/1G4qJ1v2hqsXvCCWyywnW 9oWg== X-Gm-Message-State: AOAM532zRcUilH5m75X8ia0fK+b6Us+gAnPK592U/mgcqcyRYXKJw3SA 6Iy4mzwydU8W3pz8n7DskAKuzsHJx0W+G60KHCA= X-Received: by 2002:a63:ec4c:: with SMTP id r12mr5078161pgj.74.1601197220274; Sun, 27 Sep 2020 02:00:20 -0700 (PDT) MIME-Version: 1.0 References: <20200922023151.387447-1-warthog618@gmail.com> <20200922023151.387447-8-warthog618@gmail.com> <20200924080921.GE17562@sol> <20200926091631.GA89482@sol> In-Reply-To: <20200926091631.GA89482@sol> From: Andy Shevchenko Date: Sun, 27 Sep 2020 12:00:04 +0300 Message-ID: Subject: Re: [PATCH v9 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL To: Kent Gibson Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski , Linus Walleij , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 26, 2020 at 12:16 PM Kent Gibson wrote: > On Fri, Sep 25, 2020 at 01:06:02PM +0300, Andy Shevchenko wrote: ... > Hmmm, there is more to it than I thought - gpiod_request_commit(), > which this code eventually calls, interprets a null label (not an > empty string) as indicating that the user has not set the label, in > which case it will set the desc label to "?". So userspace cannot > force the desc label to be empty. > > We need to keep that label as null in that case to maintain that > behaviour. > > I will add a comment there though. > > Hmmm, having said that, does this form work for you: > > if (ulr.consumer[0] != '\0') { > /* label is only initialized if consumer is set */ > lr->label = kstrndup(ulr.consumer, sizeof(ulr.consumer) - 1, GFP_KERNEL); > ... > > It actually compiles slightly larger, I guess due to the extra parameter > in the kstrndup() call, but may be slightly more readable?? I really don't want to delay this series, choose what you think is better and we may amend it later. -- With Best Regards, Andy Shevchenko