Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3499086pxf; Mon, 22 Mar 2021 07:50:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuDtHLeezsAMsKSovaW6r+7WrjpVhF3uhKS4gNhmmuQS5M2D0XgoHnCpLjVgCm+pnTnbkx X-Received: by 2002:a17:906:1a44:: with SMTP id j4mr81376ejf.401.1616424645869; Mon, 22 Mar 2021 07:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616424645; cv=none; d=google.com; s=arc-20160816; b=Eqq12DyCYOjYR6h/C82WmzPKtlNkywZaKX3n/9N2y6aiHTw/2WTmPbUVy9UAr/2ySA /CNAbh9ZkrRjKbX8OHJ8iEYxg1XQAPfQzRUan8ANv6QXpkuPUrSxty8MRjd1ncJAoQ1v COHEiGHDTxHjQnQrRoG5KMfIzbvzTrkgRCF10dlzXrTOFOkg1tGMqINgoXitv1U6movr JOz2T1QB2WHUO/N4hohYIv/9GHx18yp0Z/ahzYko6itKbkRFqyMN9VRu0R13QV1ok7VC 4V+qUI71TkWypac9hnAJpZFSnRhHwtg3teY7JW0yGzmVd3ZjQj/n1u0KNqDnrmMSWLVy ZcXA== 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=UaOkAUy2qlYJ4YgMgqspXxNnJI2U7fvUOZ5RFlCWVb4=; b=LnH7LODjP5YuNQh8o63KemqNQqNdq9jfs1tJ1kxNfOwHWNzpwek8GO6AizVlf6rcl8 zwp9sVnxXFpDQE9JjT8PRh268jHKMOnbWDWAK9VQvT8OF9HPxBDxk8iGaHCGGcZCmpnK Ci/vaepc8MxLrTz/c8vLXvyGgCEgkqBnDOvYDoljBETl7+5aQKu0owypI7+zLdllmZOp dryXBgN9uJ5mFIbFwuLt7zzqPB1Am15a6yQkCPm4a58G5zEveIcBe4sv4kctSjfKfkBX UFZUsE82s3cfkCrVb/NoifjvIJ89g7YWsKXkam4HuNVuITY6ZsMe8HVr5MMJ4Xfk1817 rhbQ== 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 v2si11308171ejg.251.2021.03.22.07.50.23; Mon, 22 Mar 2021 07:50:45 -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 S230398AbhCVOte (ORCPT + 99 others); Mon, 22 Mar 2021 10:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230269AbhCVOs5 (ORCPT ); Mon, 22 Mar 2021 10:48:57 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FEA7C0613DF for ; Mon, 22 Mar 2021 07:48:54 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:250b:f16c:c5e2:505d]) by albert.telenet-ops.be with bizsmtp id jSos2400j2HDxaV06Sos7T; Mon, 22 Mar 2021 15:48:53 +0100 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 1lOLrQ-009ZWI-Ab; Mon, 22 Mar 2021 15:48:52 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1lOLrP-004T65-LO; Mon, 22 Mar 2021 15:48:51 +0100 From: Geert Uytterhoeven To: Robin van der Gracht , Rob Herring , Miguel Ojeda , Paul Burton , Greg Kroah-Hartman Cc: devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 07/17] auxdisplay: linedisp: Use kmemdup_nul() helper Date: Mon, 22 Mar 2021 15:48:38 +0100 Message-Id: <20210322144848.1065067-8-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322144848.1065067-1-geert@linux-m68k.org> References: <20210322144848.1065067-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 --- 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