Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2939286pxy; Tue, 3 Aug 2021 20:46:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+ldJqjdKZU0l1eyulACfBp54K7/U6/NPRCf9PvP8EqN+2XvW3op3SL4t+ztY+QoBi+hLT X-Received: by 2002:a5e:8401:: with SMTP id h1mr3254021ioj.75.1628048798365; Tue, 03 Aug 2021 20:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628048798; cv=none; d=google.com; s=arc-20160816; b=Ynftte5W9njVsru3sg/O8pEPo7zs8MEnEFux4RhfLfLiQJ4vC2t+p4K9gkCQUDBvux zrPB8967AQ7phAyHtM7mj6cGrq7DO2NvmSjKiTurGwV2DD2azxDik0lZU+2gY72n4n17 VziYuY68qWfd9tYvhHr5Xl2b/TbgnSrfl+YS7ruT7SUlKpINbkFBYWPsxFbG84UyFZwk Tfp5UsJKlXG8KI0Il8j8EI9l0igUNV5pcJkkiVKebiJHx3A/VRjIu196ScxMSxJOev8b 7uFBIpshE+N9n0NC4f06dx4DHsP3mknzQtVeWKX3OwNVPYE+WdeUKevKLeQlh0c7s5r2 f7fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=RuQ+fcoWLUbn9bFMod8flXnZQl8qaWOfepx6FS4lUu4=; b=07lKEJJFWS0CTRsx4gJAkIAcDMyo6pNfqj+d3dBcRHIlrzzFjzhEIK09PNOLZnrvLG OY1/wLycPZtfQYdqZOLkNzHuXRwB4JIjOA/lXPOXou8TWittpzpwnjSSJd0vQnRm8BUm 1m53UzQkprnKRIj6d9HM1sOQKgmXBwLvFDQdOu3yeX8014tbvMhqFHXKgVJ33nxfYs4U 0HToN0pl7UPNF4xcaNRfQgMEDZCLPZcQZRmRdNFOAj9I5dSu+fnQFAJMI/7h1w2b/R/+ slMNEssasYD/QJf4qIKCkDoWEVw51CSeexNlw996PDz9pj2jyVabHw4yALmPWx4SlLLg KSIA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m9si951678jah.91.2021.08.03.20.46.26; Tue, 03 Aug 2021 20:46:38 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234641AbhHDCz0 (ORCPT + 99 others); Tue, 3 Aug 2021 22:55:26 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:44681 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231396AbhHDCz0 (ORCPT ); Tue, 3 Aug 2021 22:55:26 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0UhvWmO7_1628045712; Received: from localhost(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0UhvWmO7_1628045712) by smtp.aliyun-inc.com(127.0.0.1); Wed, 04 Aug 2021 10:55:12 +0800 From: Xianting Tian To: gregkh@linuxfoundation.org, jirislaby@kernel.org, amit@kernel.org, arnd@arndb.de, osandov@fb.com Cc: linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Xianting Tian Subject: [PATCH v3 2/2] virtio-console: remove unnecessary kmemdup() Date: Wed, 4 Aug 2021 10:55:10 +0800 Message-Id: <20210804025510.93595-1-xianting.tian@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hvc framework will never pass stack memory to the put_chars() function, So the calling of kmemdup() is unnecessary, remove it. This revert commit c4baad5029 ("virtio-console: avoid DMA from stack") Signed-off-by: Xianting Tian --- drivers/char/virtio_console.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 7eaf303a7..4ed3ffb1d 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1117,8 +1117,6 @@ static int put_chars(u32 vtermno, const char *buf, int count) { struct port *port; struct scatterlist sg[1]; - void *data; - int ret; if (unlikely(early_put_chars)) return early_put_chars(vtermno, buf, count); @@ -1127,14 +1125,8 @@ static int put_chars(u32 vtermno, const char *buf, int count) if (!port) return -EPIPE; - data = kmemdup(buf, count, GFP_ATOMIC); - if (!data) - return -ENOMEM; - - sg_init_one(sg, data, count); - ret = __send_to_port(port, sg, 1, count, data, false); - kfree(data); - return ret; + sg_init_one(sg, buf, count); + return __send_to_port(port, sg, 1, count, (void *)buf, false); } /* -- 2.17.1