Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1700833ybl; Thu, 5 Dec 2019 05:46:48 -0800 (PST) X-Google-Smtp-Source: APXvYqz9EV73n5Q0JsUPDx/ndhD/cntjj7q8uUkzJrU49ofkvkS66BHX3KqjLkPdnxz4f8W6vtb1 X-Received: by 2002:aca:530e:: with SMTP id h14mr6747479oib.105.1575553608238; Thu, 05 Dec 2019 05:46:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575553608; cv=none; d=google.com; s=arc-20160816; b=NUEahjdXte6QAjvi4dr2drUNL8C8teDnO8Slxw5a3sna/DgOCBbSms2/BA3z/viEwe DEsyWbOi7ERSKymX/DcG0mdsl1SEMM8hJ0ilaNgWWJPhGPhbz+qHKDO3TCHB/IVLzFcL h3bFmHgqr8jZ/u8rrsDSFR5hpKJYBtXdskDHKV3luly5QI3ZaOWkg7+Hvjv2evApZ+iR LmD41b5wG4aLOidwlDRRC8dBmm+3+iSfvAlEYkdDBHJ/MZZdvdgu3lg92Wnq79UcJcik XJvTOrL07Svdm1/m+IOp4sdukg3KQSBfkq7HS1MY8P60F657A37CQyMu0EBsXYNmb1ny Z+xg== 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=tf+pf8pQ++HUmuO8UBLmXes+nwBFFnQhR6FiiNRFLAA=; b=LDeoIIV2EE1c1RSjYlY3Q4KQ5TxIQFe8qi+jhxjf16NttIyGfQnjO3haKJcEhRcCxM 7QCrCOHs7qiJIupTLxDLtewYrYSLCqKvsOAOJBw24qn/MVVgdtABnewYI2wq4bE0uKUl w1xl0a2SoxMk7FciPl2uRBxt+WiiD1iYt92crMFW5TRKaHLfuH0ZyXhAbCydahV5LJzQ g6ruM7kbcKUDZ1YNPE5mDktHUxTz/tOYbUZ/qpC7gd+gE45B0n4nF8QYp9wi0GKqJMOe 4T00RAadUVzy5gmkqPyzqkEBP6M1kGyWerAmNPNiqN4gd75NIf6mMtE8mRvwpyfg3ehJ Enog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Rq4sXnbe; 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 u190si4791295oie.117.2019.12.05.05.46.34; Thu, 05 Dec 2019 05:46:48 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Rq4sXnbe; 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 S1729549AbfLENpt (ORCPT + 99 others); Thu, 5 Dec 2019 08:45:49 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:39887 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729165AbfLENpt (ORCPT ); Thu, 5 Dec 2019 08:45:49 -0500 Received: by mail-io1-f68.google.com with SMTP id c16so3629541ioh.6 for ; Thu, 05 Dec 2019 05:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tf+pf8pQ++HUmuO8UBLmXes+nwBFFnQhR6FiiNRFLAA=; b=Rq4sXnbep80c0TWs93z8qrTZBrMg5VhdGeYet9DaBwSa/R3qGMueRqG+2oBwRWzfp8 7I0QhSrumvg2akzmhe1p/XHMT9x5Imk5ENrAg4jTYdz0s9u2Iw9n3AMN9o9/H16C1Lb/ rjN12Kb+//iJ5INEwakrOQoSd6PmxMKkHqwucTiVmzVW4UDotREEkw4hSb5T/bk4w5/R 4lj078uBc1rgcdQowlUifQQjPukClRiUCdTpau3/WgSys4a0ogmnZh8oD9gS9LMMBba+ as6iWIC54439MN0CS5mN+lk2qSXKj/lJYMHyvRiNYzkV94rXbqARhr8MGCGpP1HkykXZ 1uAA== 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=tf+pf8pQ++HUmuO8UBLmXes+nwBFFnQhR6FiiNRFLAA=; b=CJRQMm0vZMvBLQJVRU8WbBqisJi+pO/kCu22mqarbav7OrVbNaD1pn9dy2/kLenEP5 U8nuLWyzrgJKh8uJZ0ds8MXPXX60LDrhJTQB7QfUKMtX/c2xuaKtMyd45jHKznIOE3kZ WY9+aw8ILVU+vXD0HAHdAiEflKrM7vywlOoTHuAHNN9KXVfez81fgXop8WFFOF1uuYUZ +uHY9VDVs5H7yjU7yqyHaRhosuTyg+xcTes2grK7k/nsms2HRz0G5jBxLEBi9352Odah DsOY2JuPSKDxAVpOio/OWkfQf8sXyahTngOsgqdI3x0altN5WEfSRI2OzOrDBiCLp46g h1Gw== X-Gm-Message-State: APjAAAXvc13aHZ7fAIdVaXOqk4tqPiDZQ6U2zJC0jD3v1fTf0YQdlxk0 W0pzWxe2dkH0K0FrxA4sOCpc7KtbLeNi+tYb3kAGCA== X-Received: by 2002:a05:6602:2352:: with SMTP id r18mr6150964iot.220.1575553548819; Thu, 05 Dec 2019 05:45:48 -0800 (PST) MIME-Version: 1.0 References: <20191204155912.17590-1-brgl@bgdev.pl> <20191204155912.17590-10-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Thu, 5 Dec 2019 14:45:38 +0100 Message-ID: Subject: Re: [PATCH v2 09/11] gpiolib: provide a dedicated function for setting lineinfo To: Andy Shevchenko 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 czw., 5 gru 2019 o 11:21 Andy Shevchenko napisa= =C5=82(a): > > 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 wr= ote: > > > > > + 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->c= onsumer)); > > > > + 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 p= atch 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. > I'm not sure I get it. What warnings does it produce and in what environment? I don't see any. If you want it simpler - we can do `snprintf(info->consumer, sizeof(info->consumer), desc->label ?: "")`. Bart