Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1498111ybl; Thu, 5 Dec 2019 02:23:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxn4rYE8CK9BJjSWKYbSZye7NfXHYO6tcODRC0l32pblsCVj7QSP6fs7+LTub20tAYgK+sM X-Received: by 2002:a05:6808:3c5:: with SMTP id o5mr870780oie.142.1575541384653; Thu, 05 Dec 2019 02:23:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575541384; cv=none; d=google.com; s=arc-20160816; b=Vg2RtcJCublHxlyiVmvqnBcIw4ISozaJstfj/SmzGHt9bnXKzYH5cof51wxm3a7wuo 9eAF64ofyj+5CNUPdTk0wloY9bEVdbSvXUTAUksMPKGv1O8q716O8mOhJw0Abj/cy/Ad UKao2xAXtS2YfGHA0giSdmuzVbJR71zLkbympdxNoHtHuGOol853AwslQoO7Q7may/Wm t+imGIZOVY/dTTjdNc21gSLvF1PFAxRci+nNGJ2fuAUiUmLf03UNBKQ/QxPn64NEqtRr w7/ULRt/Ocv6NIVsjFKbAfBNkh48+zLckS7E+Yq6rAklGGgWJ1ZcVVkyl+FYx8D/fToX +cQQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=g86M/m+NwKzUuZiuWQRa71hYgYNDWjvbI/gJF0jNkJc=; b=Bf559cLeOry7q8Jjz/p1KNpck40LST2nNbqmb/3x0wM/5X+oihC8c3fmMLIFM6mqn+ zK6sFAX3xTstz9Y2PuU+YU/5JL/xD90ylRGGYSECDdRjR//UykaPhXo73lzy6uqHmrFx Ypfjm2psNFy3HbzeGXvbCLb8m+LuTefSNRk3+34+6D9ypTtxAxzOEBG7Dcr9KcRt/KBM F1rrdbYNKtMUfrbATffttGujV2BjqZCHawAaTdYgtBlVP/RSYa6TmXw/n13QpVizlyYf /aXB50ZMkroFgAV+a7US10UtpyY8G5KIK7KEASdBMUxfknQpLxaCy+N+qCBXb71Hqwuj F4hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cFYmFCS3; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n62si4764943oih.198.2019.12.05.02.22.52; Thu, 05 Dec 2019 02:23:04 -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=@gmail.com header.s=20161025 header.b=cFYmFCS3; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729131AbfLEKVG (ORCPT + 99 others); Thu, 5 Dec 2019 05:21:06 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:47026 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbfLEKVF (ORCPT ); Thu, 5 Dec 2019 05:21:05 -0500 Received: by mail-pj1-f68.google.com with SMTP id z21so1101906pjq.13; Thu, 05 Dec 2019 02:21:05 -0800 (PST) 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:content-transfer-encoding; bh=g86M/m+NwKzUuZiuWQRa71hYgYNDWjvbI/gJF0jNkJc=; b=cFYmFCS3IahdOlt/5BsvGbAkW5Xu4ATpJy38lHtwxZU5uk49BUZFUK+bQtWFXESKZV Y7FzWYUDVTQB0oJnhzfW7nYcwXqqyv3AkQMcQLKVQzgRmumKCWlHuoTvJxCi2kZc8Bcr 5g+clcx7TxBHK2qil1NgPQjnbz1LDQABbYdi3DkEgLzYc4y78qmVkB1q9dve2Iejm6Z4 lC7msOIqfCG3MhOQgsMZfUXqYhChCm4qYQXXvh5hQofQ2sgs1/kkBhe9iF41WoCj9f4/ qHCohtixfJa/O/Zk0Aq1W7uOmbVOdZ9tzelaDWNYcnCuv3EAf4JJbJPhaLymSXZqupAy iBcg== 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:content-transfer-encoding; bh=g86M/m+NwKzUuZiuWQRa71hYgYNDWjvbI/gJF0jNkJc=; b=mhhVm2IQU3H+gHwHNXEMsvYqbPCs1ivVQcpFs32FdlxoPEYaDs76mjFqvqKWgGg+mV 31llKc1tVmMSnRCc1w7UK0jwMG60L7Tdld/3zTuK7OgHJ+iUkguWxtGbe7mKlXlY2Mjj e4J5adreVDq4FK/W0AC6rKrJQOQkkk3j8RqjQ62EP2uhfxC9yJcOLC/Ll70zQVe1ujzk Xt4M/FIsaIHaML+IgL4hF7RZrtMCYJU8biahduGnGgupJkU0s5neKCFFsFgONBzm9vrm 1sGZkk5VOw8owE9Woy5gfXj74dlHkC8c6trGstQFE3B11+mSGAp9JvLaaYDlIGGYEByg kuAg== X-Gm-Message-State: APjAAAWqYPnwNxzsVN/XK+LTYJQ+FkY4+xz3a7mWUM+3QyqkvdHU07Wo rvV5vp+sUbpC8Z8715IDHIq1uWsbHnRhwAMR4HU= X-Received: by 2002:a17:902:aa08:: with SMTP id be8mr8035006plb.255.1575541265022; Thu, 05 Dec 2019 02:21:05 -0800 (PST) MIME-Version: 1.0 References: <20191204155912.17590-1-brgl@bgdev.pl> <20191204155912.17590-10-brgl@bgdev.pl> In-Reply-To: From: Andy Shevchenko Date: Thu, 5 Dec 2019 12:20:54 +0200 Message-ID: Subject: Re: [PATCH v2 09/11] gpiolib: provide a dedicated function for setting lineinfo To: Bartosz Golaszewski Cc: Bartosz Golaszewski , Kent Gibson , Linus Walleij , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 5, 2019 at 11:28 AM Bartosz Golaszewski wrote: > =C5=9Br., 4 gru 2019 o 23:30 Andy Shevchenko = napisa=C5=82(a): > > On Wed, Dec 4, 2019 at 6:02 PM Bartosz Golaszewski wrot= e: > > > + if (desc->name) { > > > + strncpy(info->name, desc->name, sizeof(info->name)); > > > + info->name[sizeof(info->name) - 1] =3D '\0'; > > > + } else { > > > + info->name[0] =3D '\0'; > > > + } > > > + > > > + if (desc->label) { > > > + strncpy(info->consumer, desc->label, sizeof(info->con= sumer)); > > > + info->consumer[sizeof(info->consumer) - 1] =3D '\0'; > > > + } else { > > > + info->consumer[0] =3D '\0'; > > > + } > > > > I think we have to fix GCC warnings first and then do whatever this pat= ch does. > > > > What GCC warnings are you referring to exactly? stncpy() against partial string without NUL-terminator. So, if desc->label is longer than info->consumer, it will be copied partially. I don't check if the modern GCC clever enough to see the next operation which does the termination. --=20 With Best Regards, Andy Shevchenko