From patchwork Wed Nov 27 07:22:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 180266 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp5735954ilf; Tue, 26 Nov 2019 23:22:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwSvZ5/R8GjJWQ4Zi7kUY+yC9nEZFZoT9ngCq/eaTWAtQWbkRg3m+6yUW7gZb5z3gE7GtQh X-Received: by 2002:aa7:d9cf:: with SMTP id v15mr4257605eds.182.1574839352360; Tue, 26 Nov 2019 23:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574839352; cv=none; d=google.com; s=arc-20160816; b=lnlRe3qiyjqQPiWNiWIsQ23jsM/G5n84er+4Za+uRbcNtBI/+aQy5PdMWFNK3XsS9V JAOObi1QREOQ/qANx3Tc/zy5KoBH1189PsU7p2g0IAY3YpEz46RSOAJpBOpDaAEN6d69 MyfoLva+dmFOhhFUtxPaHwUub8IUp6Y1nxW8Om+jWD66LvaTOOl+8xW13aw7CMkyVPnO /8fJWhHQdMKelcvnbnhdtx/ZGgILV1jLwmIgFK3FnkDxulri+C3ugDJhvUOaJmW+N+n8 W5W4M4D0HSZOywlkl2zfIWSsT0SphXotjKStMPpOFbTwbOVqbNPUqleCpSL+I6KKre43 og7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=R5s1kUXvUZFaJy5wLnwelF0UUYDE5IPYznburQcZxDg=; b=S+qOfdmm1X//54WLolzcx0qAgH/OKjXWNO7sJPi6/4w6P7GyKxwARBYYXc/zoaeF/G 8VATn9MQajXO35CCoHfnC+neBSF8uRgqKAmM5aOsF64/TSjL0guwCzMYlG3+sHY2ZQJf TNRkP3LH7t7k142K2HweHX4rCbsiJ5WFuWy5aNSpZllaB8vTOnUs6a9ROVwWyL4e1Mso ROYy+ZKeofCY42Uuzdjtb4LQ9Tqgi/wrh1HuaO6AsGhHm099WGPhkrEgSazjTb8LLGn/ jW6BJ+cJPJgIpp1n0vcRwqpUFDSIP1E4ZR3RduXCzXpusoua/5MCEs2lhCOWsRd+iFpy w+OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nGUOSLki; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si69058ejc.66.2019.11.26.23.22.31; Tue, 26 Nov 2019 23:22:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nGUOSLki; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726510AbfK0HWb (ORCPT + 15 others); Wed, 27 Nov 2019 02:22:31 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36741 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbfK0HWb (ORCPT ); Wed, 27 Nov 2019 02:22:31 -0500 Received: by mail-wm1-f66.google.com with SMTP id p17so270184wma.1 for ; Tue, 26 Nov 2019 23:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=R5s1kUXvUZFaJy5wLnwelF0UUYDE5IPYznburQcZxDg=; b=nGUOSLki7E1LNbEgBb23RLE4DYeXcHGmwS1UV4LdSReQvQSWoCYGJa6mZA+Zq/GWIH zy1Qx6SrFAYsp0dq1b0XECEEDVDV0WlBh27Y+7iJS3WW4Vaz/UlR6MPkSAFu7QgyCAlR nlOjLmghgT60iMT2hT/BTBf9FI9Qd4SvI24qANCY1lNuMwTnanKW3IZASdRQO4RfKsMF EPxmaXyTQtfWJPmxcFKgCvv07kFlkB5HYeG50T5w3omsfxV1EZW76ID0cnMgQNh9wgiH 0+rjsflQnbD2sOtzS1z3c5nAEJD7xx56qHBI5yp0eVq3141pXICvq4Bd8746r87udaSH 9NNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R5s1kUXvUZFaJy5wLnwelF0UUYDE5IPYznburQcZxDg=; b=eZbceOq+t1q6NpIsGoH7Wo6vtWLmvY686EzUCYzEfkfq16uQkkG5E0SNZrZYvKxXc4 PYT/XVdM1YlsnosFGy8IIVxAyTZbOJ+jt0x0aQ1CUSK/+P/GKI8xFe4R1skZ/wI3Hk/n ftHdoHlMJKcUXPUZfK+XrMq5p8CZY6vBdjPb3Dhydvyfw2xmVZRjmrSLOimkn55GyTr/ sETLOKP38CnVDxf8G4EFg38xyJp4Q9p/A6s9GTRhVrg8JY5F0JM9LQjonDJdpmi9YLcs E53mbrkTYcaiWIW3FTnbzVoi7yLYzfJwh9Q8u3j2JpCkAaJjVZnPhQFBqQSvZ8ZhX1Mj sfVA== X-Gm-Message-State: APjAAAWUEIREj2MAGYX4jBKe50mA/g+mNgN2DaMPytB/G9B1yYNLtwhE 0GMCHd2bdsxBUnVPTdkou15117WnV8k= X-Received: by 2002:a7b:c308:: with SMTP id k8mr2693385wmj.32.1574839347122; Tue, 26 Nov 2019 23:22:27 -0800 (PST) Received: from localhost.localdomain ([95.149.164.101]) by smtp.gmail.com with ESMTPSA id c193sm5986641wma.8.2019.11.26.23.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 23:22:26 -0800 (PST) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.19 2/3] media: siano: Use kmemdup instead of duplicating its function Date: Wed, 27 Nov 2019 07:22:09 +0000 Message-Id: <20191127072210.30715-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127072210.30715-1-lee.jones@linaro.org> References: <20191127072210.30715-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wen Yang [ Upstream commit 0f4bb10857e22a657e6c8cca5d1d54b641e94628 ] kmemdup has implemented the function that kmalloc() + memcpy(). We prefer to kmemdup rather than code opened implementation. This issue was detected with the help of coccinelle. Signed-off-by: Wen Yang CC: Tomoki Sekiyama CC: linux-kernel@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Lee Jones --- drivers/media/usb/siano/smsusb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.24.0 diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index 3071d9bc77f4..38ea773eac97 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c @@ -225,10 +225,9 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size) return -ENOENT; } - phdr = kmalloc(size, GFP_KERNEL); + phdr = kmemdup(buffer, size, GFP_KERNEL); if (!phdr) return -ENOMEM; - memcpy(phdr, buffer, size); pr_debug("sending %s(%d) size: %d\n", smscore_translate_msg(phdr->msg_type), phdr->msg_type,