Message ID | 202212280944112670081@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1671351wrt; Tue, 27 Dec 2022 17:48:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXsGjy0KJZpxL4bfhjNpEeS5xzv/S0C6G/JkNpiEQ8bbRD9NyYdjxGlcrjrr0nDiOi36Fv7T X-Received: by 2002:a05:6a20:a690:b0:a5:418:8341 with SMTP id ba16-20020a056a20a69000b000a504188341mr31743769pzb.28.1672192111231; Tue, 27 Dec 2022 17:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672192111; cv=none; d=google.com; s=arc-20160816; b=VJ4yv/9c0wyhkuZZMaCdQNhdPR0edwilw5ilF6GIelBzKMLDJgO2PlJL1/cHUW6Yns xyHdGNmIYbSBqznsrhF3UNfCo+ezahAwKW9PJHzEoXXrSjD/o43g0vh1X+jGC1/gtLhp fLbQhNDK41DKfx5WbMwdB3XNxf8Yix0sRyY+PPj+Jrg7kQfBSlP8dDrI3vb/j+VQdGUv ZauwZWGp4gNIDLmKxRrHRCe9pPwOXrofmgLrPCHZ0Xbcz0zGuauekHapmo6qQ7gpHDZK lQ/uy2q5aCVLNfPpxwx5T7LvYQ2vQ6tYisLrIGMiZFCOpQn8JdRV9PeHFlBM6sT2J1g1 iYpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=YDuRUuchMmdSCKTayPTdcj8Xzb5z3uygG9OAh10jHeo=; b=WlHYoD2vscFWBKCAyxtMNr2V9NQ14ExdgIlhq7K32OgzfqNQqwr+sAP3IhLAsYUGpI TSEwPOv8+X+MRfWopgkYd1D/S1LzZZPgSeJ4kMHGy/FfmjxUzWidewXUrMPzV/VnRSXE KjqL/qt4TBxbLlbuNt9j1Onnqypv49QuzOja5sNYUwBvLgnAVeqsWY784QD1fg2Cm2Gw 4lgXmANwkaQjWiI4Pc/19h7EnTU8IVEOhDXX3oToOA6XZwYI2EzefL5xdi+8u1xI/hlQ zzB9XAnGnfZ3BmPlDrhqXOOjoesssnruz3KznNucCTXMSOVfR0ZXh89ROU6iYd7ERLKq Ee8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb19-20020a056a004c9300b0056ce0f64370si14903714pfb.108.2022.12.27.17.48.19; Tue, 27 Dec 2022 17:48:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231736AbiL1Bo0 (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Tue, 27 Dec 2022 20:44:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbiL1BoY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 27 Dec 2022 20:44:24 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4860CB85B; Tue, 27 Dec 2022 17:44:22 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NhZ7m2gCdz501Qh; Wed, 28 Dec 2022 09:44:20 +0800 (CST) Received: from szxlzmapp03.zte.com.cn ([10.5.231.207]) by mse-fl1.zte.com.cn with SMTP id 2BS1iAG9052060; Wed, 28 Dec 2022 09:44:10 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp01[null]) by mapi (Zmail) with MAPI id mid14; Wed, 28 Dec 2022 09:44:11 +0800 (CST) Date: Wed, 28 Dec 2022 09:44:11 +0800 (CST) X-Zmail-TransId: 2b0363ab9f6b7fd5e0c4 X-Mailer: Zmail v1.0 Message-ID: <202212280944112670081@zte.com.cn> Mime-Version: 1.0 From: <yang.yang29@zte.com.cn> To: <deller@gmx.de> Cc: <javierm@redhat.com>, <tzimmermann@suse.de>, <christophe.leroy@csgroup.eu>, <wsa+renesas@sang-engineering.com>, <linux-fbdev@vger.kernel.org>, <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>, <xu.panda@zte.com.cn>, <yang.yang29@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_linux-next=5D_fbdev=3A_use_strscpy=28=29_to_inst?= =?utf-8?q?ead_of_strncpy=28=29?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2BS1iAG9052060 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63AB9F74.000 by FangMail milter! X-FangMail-Envelope: 1672191860/4NhZ7m2gCdz501Qh/63AB9F74.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/<yang.yang29@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63AB9F74.000/4NhZ7m2gCdz501Qh X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753420515294994213?= X-GMAIL-MSGID: =?utf-8?q?1753420515294994213?= |
Series |
[linux-next] fbdev: use strscpy() to instead of strncpy()
|
|
Commit Message
Yang Yang
Dec. 28, 2022, 1:44 a.m. UTC
From: Xu Panda <xu.panda@zte.com.cn> The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> --- drivers/video/fbdev/aty/atyfb_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On 12/28/22 02:44, yang.yang29@zte.com.cn wrote: > From: Xu Panda <xu.panda@zte.com.cn> > > The implementation of strscpy() is more robust and safer. > That's now the recommended way to copy NUL-terminated strings. > > Signed-off-by: Xu Panda <xu.panda@zte.com.cn> > Signed-off-by: Yang Yang <yang.yang29@zte.com> > --- > drivers/video/fbdev/aty/atyfb_base.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) applied. Thanks! Helge > > diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c > index 0ccf5d401ecb..851c1236fddb 100644 > --- a/drivers/video/fbdev/aty/atyfb_base.c > +++ b/drivers/video/fbdev/aty/atyfb_base.c > @@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base) > * which we print to the screen. > */ > id = *(u8 *)par->lcd_table; > - strncpy(model, (char *)par->lcd_table+1, 24); > - model[23] = 0; > + strscpy(model, (char *)par->lcd_table+1, 24); > > width = par->lcd_width = *(u16 *)(par->lcd_table+25); > height = par->lcd_height = *(u16 *)(par->lcd_table+27);
diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index 0ccf5d401ecb..851c1236fddb 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -3192,8 +3192,7 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base) * which we print to the screen. */ id = *(u8 *)par->lcd_table; - strncpy(model, (char *)par->lcd_table+1, 24); - model[23] = 0; + strscpy(model, (char *)par->lcd_table+1, 24); width = par->lcd_width = *(u16 *)(par->lcd_table+25); height = par->lcd_height = *(u16 *)(par->lcd_table+27);