Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1435868pxv; Fri, 23 Jul 2021 08:16:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9isxmJCj5X89ir1Wh72A1/6mXTUOKSlkbc/QJAPPlojm2QvvkEBWPTZB/tbWKghbRx367 X-Received: by 2002:a05:6e02:1a46:: with SMTP id u6mr3795812ilv.135.1627053414842; Fri, 23 Jul 2021 08:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627053414; cv=none; d=google.com; s=arc-20160816; b=LTLJwoyuYicuoslSy310rek9b3zytULpP8jD8U81qPvwO5TFayPiSBQRJQcZtVph4e MY/4L14YQU/bYZEDOfgk5K0LBVlDc1JjDZq3RutlANCmuxFnvLKt03IrGAygawc7A6Du PrSffvU0nCqAseTaeDE+y0v3N7EmseYN0J8ITBltsE6HICFOwAdbO2g8HDh8obZj7/DP MVihTPMAp/4YANVVW9j0n+XEEX2DqD82lQ6NZxLYLqsSTwPAhEwiX4N2RAjoDRJYPJXg FSjqpchpr9WKtvuj0HXZLfMKh38o77xNEFYMuUut7fLdGuqnOaxLo2ovKR0FfcWistE1 Ubtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/duL4ZBoXG8eBfgpynTEVkId40hpzJcjr6dehY5x/Nk=; b=WqW4AUmMN5IiZXGNnyHVn31od7THdqKXDmIpg5clJ4HMaRvdD+l4nGx7HGoHaUMGbq fgDkqBQWHuNDqhjP8X8dd/DZFF4AY4NsgGT8AXDXtJ4qFQhDnsiix5CBO5BLCcxlTd0+ nyS0sLfaOYMvCHKmDmswoSknDe//B85aQT4teljUtKqmNnt6xXY1IUhXzKQkLaeL5c1h WKsJLZqmjN+0Pq0oHWNPKzYntc6NJUA2xORnk8VYgKzSEtAGXK73UTzh9pKawrVp5dxq TTYRTW8XWk3dW6W1KstEaS6th4KfiO6+UHlkb6Y+ytkgXRFzlVv5k3wFPV7HMMUck1Xl ZdxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="H1Y1o8/W"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si10778886ilm.23.2021.07.23.08.16.41; Fri, 23 Jul 2021 08:16:54 -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=@gmx.net header.s=badeba3b8450 header.b="H1Y1o8/W"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235484AbhGWOez (ORCPT + 99 others); Fri, 23 Jul 2021 10:34:55 -0400 Received: from mout.gmx.net ([212.227.15.15]:49171 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235438AbhGWOey (ORCPT ); Fri, 23 Jul 2021 10:34:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1627053313; bh=OjiRy3yEmPn7YKRxpzy1s0ZNeFE94rnGLnb9AsXrlrs=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=H1Y1o8/WhCSLA3gc+0iqX22b/7RsEHnJ+T3K35hIWib/0K6FkHReRw18Lwe8bI2et SGrfYjew+nX3eCngJhp4bJINYwa93afwF8BWifjCBUWOAEonZyleQtHHs2hyRhY01G IwJp/GENms9sZCLvGyVZ4cqetB01vaPu1xhJaQZ0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from titan ([83.52.228.41]) by mail.gmx.net (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N0X8o-1lCcqr2KVI-00wX6P; Fri, 23 Jul 2021 17:15:13 +0200 Date: Fri, 23 Jul 2021 17:15:10 +0200 From: Len Baker To: Dan Carpenter , David Laight Cc: Len Baker , Larry Finger , Florian Schilhabel , Greg Kroah-Hartman , Pavel Skripkin , "linux-staging@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] staging/rtl8712: Remove all strcpy() uses in favor of strscpy() Message-ID: <20210723151510.GB2612@titan> References: <20210717155145.15041-1-len.baker@gmx.com> <20210719053747.GN1931@kadam> <20210721080624.GV1931@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210721080624.GV1931@kadam> X-Provags-ID: V03:K1:EjRz48SDHlgr1UpUhBNgHpxEM7iMvIZeYSbMqtOd1Qri1AfHw4I rJ8JN6O4hqGwyTqfQgAAa79cnga98vlF3R/AeoCXJMUuBBVEM7AN/b2gMJKvDdoL5KRjeu/ tovnT0UgvwdS5yr+DGM/NkVq5ZdlXaa5FYJU0cu48Xl65UsX07VNdRRzfvrr6NUSauVrMUE Qgi9u0UgkDwUkEGbx+lug== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ojBJ4x3ZywM=:h8VEkbI3Xfc0vDCVs9p+5D bqZ5qDKdnnBaJRewL45NwPqchkzMZRs3ujPsDHwnzZLdzXD8ivKqQHDXdPd+oF2tWzjnb06Tt vb+cOG9kzhhZpCLpDRa8eLLwdO3bHosmcPg8p454Oj/4cMcngizLidvch0NNgIRTm/v6zUD5s wxtSZnmKHsbGsuUYzyyg4LVNWh5Jz5YxM8qj4LwD3zqBZWAZvSVNhqhjy0yUGfMrVRzf6ZbXp D7eukbykaSIw4SGWKyA/StUF71DAHH2mB37pJQUmthF27uWVFaU8lHmwrH6IturgtHQYSKlGz rF53Dcx9kzSxizsAMT4wQStt6O8wHlyg1PEpFpnnllknfoCjFfZ86KmtIKbqIJfxaDIoKb8cR KASpUSk7nUiRlgpAJGR/Cx4/xx/P76kujEjj3GiITHdlKFd/CKeepGrHdmqVgA+cGkzHs5bOz bouLDJ7IJK52zV+tRuamR9n/knyjaA8oPAHmjx2yEtmmzryhB34YkG4LzyLyne0X53MxHyjmt gqgWmQ5g8WsgHUzA6ooFyQTlOMXv9OdYhvyiqzX55xYtSObqKw1QTZ4JXU0J+b2Z0MwO9n1Tw AYCSnqPrmcVrZHjaOXTxb0FNpTPL/G7mo4kdBEPlG0kkk7ZfQfJ00+BO3wSb8RQoSt2qHyFrt SUUy47HmqwoRu9T8ghOcGUoCgAIsYbmrR0j+xTu9XkzSdArlgMbthdHneqiEn7R9LKDxOjxp1 2PLlpn7FAtzJezVh2TFHBJ39bPA4jI+eP55n5NzXPYdatAPbSawvrrNz92/oFSZdM+Rg4wd8K 5wM534+63/Pb85RCv8j3eEXvkkE+FLseNBtng0cTpuXBKJdFE1JdLowEn41wEO87DVJKCvZpd I/hURtPc3V45BPDCND2+lmZRhujieyXahNLamq5lP2t1Q0uTkMQLmLua8UU6TrTL/EgZcV0RZ 33lNN+BOtQg3Dkaij4um2v4VSt/n1zXfkjxiTKKi5RGolzeBbyaTKo9QILQKv9CpVd3B/ScNo CSjoH89x1JP9spRj0LL2vQ5TjGZ02LPfkdm/olRI2eXLFpHZRa63MNsIRwKuwbBuq4+KXQOC3 IAXzqlhHgp88dpXZzruNW+LX1KhiQFQZr7q Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Jul 21, 2021 at 11:06:24AM +0300, Dan Carpenter wrote: > On Mon, Jul 19, 2021 at 03:24:38PM +0000, David Laight wrote: > > From: Dan Carpenter > > > Sent: 19 July 2021 06:38 > > ... > > > Not related to your patch but this code is bad. What it does is the > > > "ifname" can be set as a module parameter. So instead of testing if= it > > > has been set, it uses the checking inside dev_alloc_name() to see if= we > > > can allocate what the user requested. If not then set it to "wlan%d= ". > > > If we cannot allocate what the user wants then we should return an > > > error. > > > > > > It should do: > > > > > > if (ifname[0] =3D=3D '\0') > > > strscpy(ifname, "wlan%d", sizeof(ifname)); > > > > > > ret =3D dev_alloc_name(pnetdev, ifname); > > > if (ret < 0) { > > > dev_err(pnetdev, "allocating device name failed.\n"); > > > return NULL; > > > } > > > > I know only root can set module parameters, but having one > > that contains a string used as a printf format seems > > dangerous at best. > > > > Isn't it best to let userspace rename the interfaces later on? > > Yeah. I think you're right. Sorry, but I don't understand if the code needs to be improved or not. Is the code shown by Dan not correct? > > regards, > dan carpenter > Thanks for your time, Len