Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5738269img; Wed, 27 Mar 2019 14:21:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqydB5HG6kZgdPzDSCpsESFboIhfa9CFWvKKHrfKQs24jVoPA6hsTV4AnXdGB8iAyHMwIUqu X-Received: by 2002:a65:6559:: with SMTP id a25mr33289140pgw.99.1553721669638; Wed, 27 Mar 2019 14:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553721669; cv=none; d=google.com; s=arc-20160816; b=M93AsCz0hMvEpnq42ZFfiso33QF+5PWOKF2F+JVLYJ+WXSt7B86SqrKJHVP5uWT8r5 Y5ej3FMwfb7hT3kMeSOaHLsd/oDqBy6NY+IoaZc/Sq34VyboYFuKeky0T1LVGPoshoBD RSWpFJ4vASrslmgsS5uiQA4sNQpGC9/p3PcDiK5AKELZQ72Um8firwSJi7V+HHv+rdL7 wpUHx6A60YYylb/QtbknHIAt56q4ZoAt61P6MNsI6ZF4CDF0vMFQ2QCTKEAnc4wOuJKn cZ7l7fzle7k/23mr/HZRy95VXsRyTj+vkV1b26nybQYkWm8Ztw81AIKWw5C6ebOoFjCh qGOQ== 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:dkim-signature; bh=dgBgvHD4VaNUc6w7Qklt9Uw5siX01DXVAa2M0l9n95s=; b=JAA+Yxs7Me54z7/6U3stv/cvES9rj44XDPPHIMWXER71D9jJ921mNaWqIlJTiSe2Hg cKENe/5X9TWsyJzHJNXvTFFHgsMvEY77ZJraovW8YHec4g8Ww4iM8FFZyx/6RwC7bozq h3jWgVgip3xiky8sjCs60nGgxg/zKUSJue3a/Mlsc8gZeptP7JGND4uPNnF+a4eBgqN7 ZNFZTiXAje+qrNXmMp5rOxikPn+J6A62EYLjFEYnS8J/AsBc6IDEoshK8lXASUxWGRO1 t/c8wjIbp8wIiNkOKfr46d61xsz9sAfynUn6JB6GwH29q/I11YEOpqxIymyQUYwl512y HAAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gp7f50xN; 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 h35si21141251plb.180.2019.03.27.14.20.53; Wed, 27 Mar 2019 14:21:09 -0700 (PDT) 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=Gp7f50xN; 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 S1727766AbfC0VUR (ORCPT + 99 others); Wed, 27 Mar 2019 17:20:17 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33424 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726891AbfC0VUR (ORCPT ); Wed, 27 Mar 2019 17:20:17 -0400 Received: by mail-lj1-f194.google.com with SMTP id f23so15762983ljc.0; Wed, 27 Mar 2019 14:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dgBgvHD4VaNUc6w7Qklt9Uw5siX01DXVAa2M0l9n95s=; b=Gp7f50xNLzqzsxK3+ruWUvOJU/1ysiIp2d5TUcl8qYUBGG5SygIDE+OHtQJsvrU1aF D1UU9wxXIziuYFDc7/KN9HzEiFlURYBdXUvgf54iBkyRtVf9Xur2dHm4bqmBGI3o6bXu c/43/5nqOWmo0pL1k981UYEkINi5GBhlgaXBB9vnvK1I0zAG9CSppXOvAY8y9mwf0HDA Y7z5n2OZlqU3/yNaJELCGb5N5na1Pi5V8lcyZ96nb3078OKnMgg5wt+p35erDC/5NixA 2edyRZrPYf+SmgaRpJUgGFvdSXxntjx2fAwepv0RvmUxaCGRacNjrweL/gGC9Z88GK0h a1gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dgBgvHD4VaNUc6w7Qklt9Uw5siX01DXVAa2M0l9n95s=; b=fCmnnVjH/A3j9nW8gQw3QxDz5mIM0sW6vyum3y/gDVa5wZluzZnTS0iEiBewx4udtd 27FbHquFv1ACSulspuoV0sl+67dx2HXhw2YvD3dJmjLcS/CI+7JtBZWHfKCnTduDOKB2 hHt0siBXqELtYaje4Vcic9RkVu075stR7Ne75DJwsfUToDcEVfkEg7C//chl5QlIB4ik zNbU53Yb6nChTAFNFu4J0oaZ4emifpstbEXG70hmVjK9l6P606kkKlxP5GI3dNyqz/yN FtLUJwl0A8ZGfgEuxTaoowBbfX09iqzY2K4FRJzRq9L7oy/ISPd3Qm/bIV0nFx7GYBya x00Q== X-Gm-Message-State: APjAAAUI0oL6F2d7RJX2sYDdi7HNtc8VK5cRV43MD4+a9Z7ybURMROYn /tOgV5ZFWcWvvIOBFofo0+mCrIqN X-Received: by 2002:a2e:968c:: with SMTP id q12mr20720293lji.36.1553721614616; Wed, 27 Mar 2019 14:20:14 -0700 (PDT) Received: from [192.168.1.19] (ckh73.neoplus.adsl.tpnet.pl. [83.31.83.73]) by smtp.gmail.com with ESMTPSA id s64sm4969361lje.49.2019.03.27.14.20.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2019 14:20:13 -0700 (PDT) Subject: Re: [PATCH v2 1/6] leds: netdev trigger: use memcpy in device_name_store To: Rasmus Villemoes , Pavel Machek , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= Cc: LKML , linux-leds@vger.kernel.org References: <20190313202615.22883-1-linux@rasmusvillemoes.dk> <20190314140619.3309-1-linux@rasmusvillemoes.dk> <20190314140619.3309-2-linux@rasmusvillemoes.dk> <987c3e60-edb3-44f0-be28-434c70bb8659@gmail.com> From: Jacek Anaszewski Message-ID: <21193aab-7880-d116-64e8-dd08afe5a47f@gmail.com> Date: Wed, 27 Mar 2019 22:20:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: 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 3/27/19 4:26 PM, Rasmus Villemoes wrote: > On 26/03/2019 20.53, Jacek Anaszewski wrote: >> Hi Rasmus, >> >> Thank you for the patch. >> >> On 3/14/19 3:06 PM, Rasmus Villemoes wrote: >>> If userspace doesn't end the input with a newline (which can easily >>> happen if the write happens from a C program that does write(fd, >>> iface, strlen(iface))), we may end up including garbage from a >>> previous, longer value in the device_name. For example >>> >>> # cat device_name >>> >>> # printf 'eth12' > device_name >>> # cat device_name >>> eth12 >>> # printf 'eth3' > device_name >>> # cat device_name >>> eth32 >>> >> >> Added tag: >> >> Fixes: 06f502f57d0d ("leds: trigger: Introduce a NETDEV trigger") >> >> and applied to the fixes-for-5.1-rc3 branch. >> > > You're stripping lines beginning with #. This is the commit in -next: > > > commit 09466021a80c926aa7de68e5162bdfea2a117483 > Author: Rasmus Villemoes > Date: Thu Mar 14 15:06:14 2019 +0100 > > leds: netdev trigger: use memcpy in device_name_store > > If userspace doesn't end the input with a newline (which can easily > happen if the write happens from a C program that does write(fd, > iface, strlen(iface))), we may end up including garbage from a > previous, longer value in the device_name. For example > > eth12 > eth32 > > which is entirely useless and confusing. Please fix this before it > actually hits mainline. And you may want to look into "git commit > --cleanup" and/or "git config commit.cleanup" (scissors is much better > than the default strip). Thanks for the heads-up. I must admit I'm hitting into that for the first time. After "git am" it was all OK, but it got screwed up after "git rebase -i". And having "commit.cleanup = scissors" set globally all the time is annoying if one extensively uses interactive rebase for rewording commit messages. It entails the need for manual removal of the whole stuff that appears then after actual commit message prepended with "#" comment characters. This is probably the reason why people use often other characters for command prompt (see the other fix for ledtrig-netdev). Note that, while it is of no so great importance for mainline, when people cherry pick such patch to their out-of-tree repositories and then rebase, they hit into the same issue. -- Best regards, Jacek Anaszewski