Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2441471imm; Sat, 12 May 2018 12:00:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp5G6+6P8TjEl4Ck8+s0ih778jqwImDP3ieCCmjR28X71Lj1R3Z9AJ9LfZ7zjJ28GDgrDV7 X-Received: by 2002:a17:902:8f8b:: with SMTP id z11-v6mr3403960plo.203.1526151616098; Sat, 12 May 2018 12:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526151616; cv=none; d=google.com; s=arc-20160816; b=uPKzurKa9RTfUXF/YVD09iyBfT7c7+sK3+iQXB/4zKyepPO4oddiGP0t5MwX4jaqzL OXGha3/NBbDChdthz4jtwDn9TXeN8PpBnewG9SUxCjx55Z6EEaWyWs04DRejWsqibxkn SDLtEflWh+h91yMNZUzBCCJ1aFQZ3Q5zyDUhz/IGNXkuGVOjjcntniH+wnlMcJLJ8lgU 24KYm0aFThO8n40yaDgc9kbJxjQWfWf6CIZautUg8/479DVKBsb6aLBY95l49rEZoGHK pSm2g+f2u4D0NJahknqkEN+gAoN7QyUUK8TrKMnIr4gNPOBRDveZiprcHr+IuByUFw5I IkNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=M7+3vj9em1WXhoYZc31GsYvR4tqZN0nOBIIEiyt0Qcw=; b=TF5h6DSsFYd3cQYrUoN6p+xl1Ff9JbVzD075w0hG1ZYJvdw5GRIMvmUohR5WzNFpPH JrC1m4hBNz+WGNnqdGAlLYsM7Iv/vyahicrOYLV68Qo523EM/XHv8/zuEkEBhOOezYf1 XtSBzzpbc9pbP1Iprr5Gco5dok46+lA8Q1z7DNMes/tDjwZTdXmQ/4csgeygMSIjRWWj KVeSPx1e49CEi5bSu3SuSB2UNy9mqhNWNgxNcWyTtOtgc8HtRkK/pl1+lgReMJX9lMnm x9QWUNQUWc7e7FC9Qs9sHOA0KMjVEF1IGSQJRvnVFSB75Nw/nsv4wU0mEu/lkOR3oK02 9ELA== ARC-Authentication-Results: i=1; mx.google.com; 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 75-v6si6129956pfv.262.2018.05.12.12.00.00; Sat, 12 May 2018 12:00:16 -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; 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 S1751747AbeELS7q (ORCPT + 99 others); Sat, 12 May 2018 14:59:46 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:56943 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751096AbeELS7p (ORCPT ); Sat, 12 May 2018 14:59:45 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fHZjw-0004F1-2B; Sat, 12 May 2018 20:59:32 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1fHZjs-0005wt-4S; Sat, 12 May 2018 20:59:28 +0200 Date: Sat, 12 May 2018 20:59:28 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Pavel Machek Cc: linux-arm-kernel@lists.infradead.org, One Thousand Gnomes , Florian Fainelli , linux-kernel@vger.kernel.org, kernel@pengutronix.de, Mathieu Poirier , Greg Kroah-Hartman , Johan Hovold , linux-can@vger.kernel.org, Jacek Anaszewski , linux-serial@vger.kernel.org, Jiri Slaby , Robin Murphy , linux-leds@vger.kernel.org Subject: Re: [PATCH v3 1/3] leds: triggers: provide led_trigger_register_format() Message-ID: <20180512185928.nzeyvxqnvfefqnzj@pengutronix.de> References: <20180508100543.12559-1-u.kleine-koenig@pengutronix.de> <20180508100543.12559-2-u.kleine-koenig@pengutronix.de> <20180510112101.GD6977@amd> <20180510112229.GE6977@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180510112229.GE6977@amd> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 10, 2018 at 01:22:29PM +0200, Pavel Machek wrote: > On Thu 2018-05-10 13:21:01, Pavel Machek wrote: > > Hi! > > > > > This allows one to simplify drivers that provide a trigger with a > > > non-constant name (e.g. one trigger per device with the trigger name > > > depending on the device's name). > > > > > > Internally the memory the name member of struct led_trigger points to > > > now always allocated dynamically instead of just taken from the caller. > > > > > > The function led_trigger_rename_static() must be changed accordingly and > > > was renamed to led_trigger_rename() for consistency, with the only user > > > adapted. > > > > Well, I'm not sure if we want to have _that_ many trigger. Trigger > > interface is going to become.. "interesting". > > > > We have 4K limit on total number of triggers. We use rather strange > > interface to select trigger. > > > > > @@ -115,13 +115,13 @@ static int can_led_notifier(struct notifier_block *nb, unsigned long msg, > > > > > > if (msg == NETDEV_CHANGENAME) { > > > snprintf(name, sizeof(name), "%s-tx", netdev->name); > > > - led_trigger_rename_static(name, priv->tx_led_trig); > > > + led_trigger_rename(priv->tx_led_trig, name); > > > > > > snprintf(name, sizeof(name), "%s-rx", netdev->name); > > > - led_trigger_rename_static(name, priv->rx_led_trig); > > > + led_trigger_rename(priv->rx_led_trig, name); > > > > > > snprintf(name, sizeof(name), "%s-rxtx", netdev->name); > > > - led_trigger_rename_static(name, priv->rxtx_led_trig); > > > + led_trigger_rename(priv->rxtx_led_trig, name); > > > } > > > > > > > I know this is not your fault, but if you have a space or "[]" in > > netdev names, confusing things will happen. > > Hmm. If we are doing this we really should check trigger names for > forbidden characters. At least "[] " should be forbidden. I think you don't expect me to change the patch, but to make this explicit: My patch doesn't make this problem worse, so this would be an orthogonal change and doesn't affect this one. Spaces don't seem to be allowed in netdev names: uwe@taurus:~$ sudo ip link set wlp3s0 name 'la la' Error: argument "la la" is wrong: "name" not a valid ifname (Didn't check if only ip forbids that, of if that is a kernel policy.) I could rename my device to "lala[]" though. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |