Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp737648pxb; Tue, 14 Sep 2021 07:43:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIIhfaNSJSg6yvCHoBX3+Uyitt33sRFVCD9zBnDufRTzZ+6mTAW6SkroLVxtQWWDzTB7aJ X-Received: by 2002:a17:906:c0cd:: with SMTP id bn13mr19142873ejb.251.1631630608047; Tue, 14 Sep 2021 07:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631630608; cv=none; d=google.com; s=arc-20160816; b=P4c87b4wUO2Xko+5d5aSC4HTFbvkF/my+Ua9KjbJXouKexEsb7hpLjnqL3Kiqgi62F Sh5j0wFIYlBgrsKkSCanDFY6DuMRNdMM8IdfeVq7EgU1ro06OU4FleJNFK7vdLpJmIJj ljwAlB/JSOmvC3QRthaybLa1PwsccQvNeanG2k8LoiJ8J46MKrhMt7Zt7s48EDtaJPbC lNoqm7mpSHxYtNH3S1S67Gzy1oO5XjuPWCFJaRSDguVwWCysoR/TkMVky4RrhzI2gxY9 mwHFwdU1o8akQcEBVr2zUPlUFnNxAsXxe0Q3WinfPeOtsZgDrGYloYVyeiXyBJNvTR7l fd+g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lFkgYpgKxNZgivSd+ksYWfFAZCHV6dodbEGVPSU4wjc=; b=XIOZmlk+vUQaDjQoWt4dsIbHR/UYE/Aix/01kHZuy471uH//tXY1Al2NC32QA1xZad uXSfkOTmcrd22ygkv2QX3rBmmGHsR/DL3wN1u9xLxNXq0O+AbXEiDq/XrPI27Dz7Nlku 58uAs8NcCo1lHA9F54wA3QE3M1EwXST3GL2c+5Do0c3yBAPB+Aszu0+VnpWoWBAcsZcO NIBV+0NiKp/AzQM+dscTzVbmZ9Cg3V9+E3GyimyUfShfxWhNPmA7lqd5TsbQZRgfXk0i JOkSTfVGGK1RU5kLGaZyXcizc4Qvy8dY/G2fyO4owf1U7RadAivEgDtHPm9ElL2EcMHU GbCg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si10408884ejm.510.2021.09.14.07.43.03; Tue, 14 Sep 2021 07:43:28 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234023AbhINOkP (ORCPT + 99 others); Tue, 14 Sep 2021 10:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233828AbhINOkC (ORCPT ); Tue, 14 Sep 2021 10:40:02 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2303EC0613E1 for ; Tue, 14 Sep 2021 07:38:43 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:d46f:7eb5:4a37:9d14]) by xavier.telenet-ops.be with bizsmtp id tqef2500S2aSKa101qef6H; Tue, 14 Sep 2021 16:38:41 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1mQ9a3-004VGm-5g; Tue, 14 Sep 2021 16:38:39 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1mQ9a2-0028yb-MB; Tue, 14 Sep 2021 16:38:38 +0200 From: Geert Uytterhoeven To: Robin van der Gracht , Miguel Ojeda , Rob Herring , Paul Burton Cc: Greg Kroah-Hartman , Pavel Machek , Marek Behun , devicetree@vger.kernel.org, linux-leds@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v6 07/19] auxdisplay: linedisp: Use kmemdup_nul() helper Date: Tue, 14 Sep 2021 16:38:23 +0200 Message-Id: <20210914143835.511051-8-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210914143835.511051-1-geert@linux-m68k.org> References: <20210914143835.511051-1-geert@linux-m68k.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the existing kmemdup_nul() helper instead of open-coding the same operation. Signed-off-by: Geert Uytterhoeven --- v6: - No changes, v5: - No changes, v4: - No changes, v3: - No changes, v2: - No changes. --- drivers/auxdisplay/line-display.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c index 4b97c20ac0b381ee..3f35199bc39f511f 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -91,13 +91,10 @@ static int linedisp_display(struct linedisp *linedisp, const char *msg, return 0; } - new_msg = kmalloc(count + 1, GFP_KERNEL); + new_msg = kmemdup_nul(msg, count, GFP_KERNEL); if (!new_msg) return -ENOMEM; - memcpy(new_msg, msg, count); - new_msg[count] = 0; - kfree(linedisp->message); linedisp->message = new_msg; -- 2.25.1