Message ID | 1c94c99117617c1a844f6551b7bca27f23c5f0c8.1697871190.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp152459vqx; Fri, 20 Oct 2023 23:54:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKQS4zPsyj6OSmShn+mzyMoNZ46DAoOzXlpacx5uypXRYnKbJGl9hoaWRMD2y/MuYUwPv5 X-Received: by 2002:a05:6a00:21d1:b0:68a:5cf8:dae4 with SMTP id t17-20020a056a0021d100b0068a5cf8dae4mr5441401pfj.3.1697871244099; Fri, 20 Oct 2023 23:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697871244; cv=none; d=google.com; s=arc-20160816; b=U2KSmxz2K5mnC6f5QpPH65Br1I8tUR8ReeeDrzOBNfgtz5rF8kvUDM0hamD2d0unbU 8JoFz25A8qCt3daio30g3ZNmVLL0f8oEsYazGaUAMpDPyR+XBt/s2uize9C8qBCcsVa5 5WwViwgDxCH0Pxhi8cMcaUuaGI2Ky1dSotPQMInaKctD9ujREJLm1U8Z9wBJQn9mRLRw iPuRfHcAxYvV2M/xmQiSCHa/zy9+sgx0SD6dEfqT/by3SyV9sA2IKtvKzgqTY41y8wbK PyBCUn28gcSXz1jw16X/Ejw4kxM3cjz/bYlH5cmL53yUe58yNlCL4tOVu20ENHuMBzTv o/mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=q+6YiMf4FjJqpY2woNDtEvfJ1SZWEDzhFtZ1+ypv620=; fh=IpAoiC+vZxiPgUAYiNOtvgC0YPAWvWmGgmoors9OL4Q=; b=AFkAc07sf7hdDcsm4SB8bBRgJAI1vOr/w8tTJ5oCBjgrU2OZhdF9OUC5CvJsEf1XoD oH3sCcylN3R+rZIM5+0wbMrj0qe+umFIKo95ORPUvsy/Ys73c6V/0lcaVZCuX4BifcLc cti18SdAAgvcln3tCvuie01acaP37SSQq4N/cE9FgTMBWYttp/j5upsEA9b5yTTbiS3W 0HWxhfNi5Cc70zuM9umKknhw6VXGkA1cOlO905UoUqTWrevOO77H4dGrqM9yC0aFFnMH KuXFNfvzbai2A4YmG+4VJ+twoLFoR9CyFPoZtqL9hZbGAEhKjLoDZQ0UFFYsBiMSic2x GDTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EysZyvuN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id ch12-20020a056a0208cc00b0057d08dac754si3146573pgb.671.2023.10.20.23.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 23:54:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EysZyvuN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 4B4A48031D73; Fri, 20 Oct 2023 23:54:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjJUGxr (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Sat, 21 Oct 2023 02:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjJUGxq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 21 Oct 2023 02:53:46 -0400 Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24052D71 for <linux-kernel@vger.kernel.org>; Fri, 20 Oct 2023 23:53:43 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id u5reqyZLtd4Wtu5rfqqNO4; Sat, 21 Oct 2023 08:53:40 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1697871220; bh=q+6YiMf4FjJqpY2woNDtEvfJ1SZWEDzhFtZ1+ypv620=; h=From:To:Cc:Subject:Date; b=EysZyvuNjvivikTZz1HV6uPNxwar1FxYeIW3ZPl6RB94dHadJkAhx/cMu/4K4ad/V N1VEKRFwKHTh8ZUL5HRXQptbuvrhFE3V+gUP/lZ+2mpFJoKjKpgpcB9uEdNttXL8dW FEYGs7+OdgBqoZ86yNQ6UFX0tz2V0Lky44jfLSnysdNY4nth95725mV4TlqLVEiToW fvX6Z+teSxGjh1Tb5asFg2GSfGrbpwongRfMXRnXjDc4vAWv8GbbK2jydBIPoNdnTe 0vl8DSe2v/n3hiR7lqTtgo/V7vctb5Qjlzc55Nkmgqm66B2/+EDwU8wGR/38okyH8y hSOtX7pWH5BaA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 21 Oct 2023 08:53:40 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Helge Deller <deller@gmx.de> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH] fbdev/offb: Simplify offb_init_fb() Date: Sat, 21 Oct 2023 08:53:37 +0200 Message-Id: <1c94c99117617c1a844f6551b7bca27f23c5f0c8.1697871190.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 20 Oct 2023 23:54:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780347037513776518 X-GMAIL-MSGID: 1780347037513776518 |
Series |
fbdev/offb: Simplify offb_init_fb()
|
|
Commit Message
Christophe JAILLET
Oct. 21, 2023, 6:53 a.m. UTC
Turn a strcpy()+strncat()+'\0' into an equivalent snprintf().
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is *not* even compile tested because cross-compiling leads to
some errors like on my machine:
cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so: ./scripts/gcc-plugins/randomize_layout_plugin.so: undefined symbol: _ZNK6frange6acceptERK14vrange_visitor
So review with care!
---
drivers/video/fbdev/offb.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
Comments
On 10/21/23 08:53, Christophe JAILLET wrote: > Turn a strcpy()+strncat()+'\0' into an equivalent snprintf(). > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> applied. Thanks! Helge
diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c index dcb1b81d35db..b421b46d88ef 100644 --- a/drivers/video/fbdev/offb.c +++ b/drivers/video/fbdev/offb.c @@ -423,11 +423,9 @@ static void offb_init_fb(struct platform_device *parent, const char *name, fix = &info->fix; var = &info->var; - if (name) { - strcpy(fix->id, "OFfb "); - strncat(fix->id, name, sizeof(fix->id) - sizeof("OFfb ")); - fix->id[sizeof(fix->id) - 1] = '\0'; - } else + if (name) + snprintf(fix->id, sizeof(fix->id), "OFfb %s", name); + else snprintf(fix->id, sizeof(fix->id), "OFfb %pOFn", dp);