Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3922566rwl; Tue, 27 Dec 2022 18:14:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXsxgNWUgaKBQ/HkjY7BiXi5GwGgNy7eLR1w/AmGELv+Anb3O5U4/ODN5iJxtV/R2cPKdW+j X-Received: by 2002:a17:902:e054:b0:189:fba2:3756 with SMTP id x20-20020a170902e05400b00189fba23756mr22328902plx.66.1672193662592; Tue, 27 Dec 2022 18:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672193662; cv=none; d=google.com; s=arc-20160816; b=AbLL6D4+7JD5QbeAM76IdKxe+MF8n6S7+VASAP6kaEuISMaCsr4lqQhbkzukAm5HC4 Wri9JO7nQgc0lSMwQU0j/lkr1lZTqBn0ZS7zIQJufz5nA00btgc4aBXjVyfuPPaF/fPZ K4fivUugQ8agKlc5I42YwzAu1RmcXIEYG2Iy1++9nnqzYeq3FtH5UsEMK5XgzBLpiT+1 b55Z0ceXyumzdtuCqbPGjxjnASkt6qR1AMj2ZzWo3YXbwEhB9AnkO8BvUdMP0Zq+ScaB Xv9Q/f9b9zUZjnkivomY7rU704oT7JwjlaX9uvsrbINBsALl5ID0Q1KUSKPQ74byEz9G blNg== 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=ZH5IlJbPedY0aKoQW2jKZlYakpGane+RyB6uWrHBtgM=; b=M32RMZLGOX1gsLzQJDvyG4HyZVA4UGMcLqwwlwMZX7EkGuB1zfiCJVQi09loxan2m0 QCaLLkkDsoAbmBRYnEu7d1I2R7A3DN7N2LI85PQH0N6zSMYCCtOKYLAExbNYz4yocvzV gXoEwfY2//I8gdYNVAY0xINNoSf8+sMz44HEAUZNabl+Nzj03JOLOsm57RVIuJxwpF+w D7VYYAdvpecOMUkym1qM1mpLf91U9RMsmTrPfiAHVh9MnO5Kp3RMxYK/LXTvaRumuMzT gHQVevwxH0X2eeaPzGwhljJ6G0DaBmjo23+P1lZ/XoJswTsaltbIPWva5PiD2nUXuTJ3 vdMA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a65418a000000b004786f5e24f9si15069890pgq.94.2022.12.27.18.14.14; Tue, 27 Dec 2022 18:14:22 -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 S230127AbiL1BkL (ORCPT + 65 others); Tue, 27 Dec 2022 20:40:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiL1BkI (ORCPT ); Tue, 27 Dec 2022 20:40:08 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04A31DF94; Tue, 27 Dec 2022 17:40:08 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NhZ2t53W1z8QrkZ; Wed, 28 Dec 2022 09:40:06 +0800 (CST) Received: from szxlzmapp06.zte.com.cn ([10.5.230.252]) by mse-fl1.zte.com.cn with SMTP id 2BS1e0df048934; Wed, 28 Dec 2022 09:40:00 +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:40:01 +0800 (CST) Date: Wed, 28 Dec 2022 09:40:01 +0800 (CST) X-Zmail-TransId: 2b0363ab9e71ffffffffbc84f49e X-Mailer: Zmail v1.0 Message-ID: <202212280940017919910@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIGZiZGV2OiBvbWFwOiB1c2Ugc3Ryc2NweSgpIHRvIGluc3RlYWQgb2Ygc3RybmNweSgp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2BS1e0df048934 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63AB9E76.000 by FangMail milter! X-FangMail-Envelope: 1672191606/4NhZ2t53W1z8QrkZ/63AB9E76.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63AB9E76.000/4NhZ2t53W1z8QrkZ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Panda 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 Signed-off-by: Yang Yang --- drivers/video/fbdev/omap/omapfb_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c index 17cda5765683..1f3df2055ff0 100644 --- a/drivers/video/fbdev/omap/omapfb_main.c +++ b/drivers/video/fbdev/omap/omapfb_main.c @@ -1447,7 +1447,7 @@ static int fbinfo_init(struct omapfb_device *fbdev, struct fb_info *info) info->fbops = &omapfb_ops; info->flags = FBINFO_FLAG_DEFAULT; - strncpy(fix->id, MODULE_NAME, sizeof(fix->id)); + strscpy(fix->id, MODULE_NAME, sizeof(fix->id)); info->pseudo_palette = fbdev->pseudo_palette; @@ -1573,8 +1573,7 @@ static int omapfb_find_ctrl(struct omapfb_device *fbdev) fbdev->ctrl = NULL; - strncpy(name, conf->lcd.ctrl_name, sizeof(name) - 1); - name[sizeof(name) - 1] = '\0'; + strscpy(name, conf->lcd.ctrl_name, sizeof(name)); if (strcmp(name, "internal") == 0) { fbdev->ctrl = fbdev->int_ctrl; -- 2.15.2