Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1186949pxb; Sat, 4 Sep 2021 02:44:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJTONpk2khrGQB2aFfvYiPjMccSPPpXtiVPyQAZn3tVtF4gD+qkSvFecKVINXowpEcpev5 X-Received: by 2002:a17:906:2b56:: with SMTP id b22mr3301791ejg.189.1630748640216; Sat, 04 Sep 2021 02:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630748640; cv=none; d=google.com; s=arc-20160816; b=i/oZmrHC0hLERWgAvz57q/4yPsTQxkORNI6LtGRQ0QL5P2vl3zZRK30NtZ9ykWq9AD UoOhp6nMJnxoCIQ/gMpWpQ3ca60OcPabxfu9ODXyvA0gN0VJXIt2jjlf2Yiyu7NWTuVJ Yt5f65OoHzKqD+PQzmne3De5hz8R4JKKChqLrSo/1PvUfqqfxWzlmmPqhbyZNbNsTx/X H2A9lpAihLTBMHmsxCtdd7casvYNM93gYtMnmd/S4hO1EbwCGiChDWzWOMUv0Pid21Zi nCITSZeTbmauZajXzqXdHWEQu/j2jEWg7/KRSkYEn3AiM7iQCvfKLmlChEbIB4nFmTFZ FOeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:cc:dkim-signature; bh=2CvcJSiEN9MNXuAzxJzwyEfnTU0mKkfe0+AjDJ9kifY=; b=OzaYcXSfayVam8N53iZ+ZlBbQsByIolJdH4aPRsc/VVrFMvG+XxGs4G7KSyT9s6jl+ qO1Tnd2Rr+VshuQv1R79loPnHQDoMh2UUg8022zyb1b2xi61A+hx/eHzcbifH/zCE3f8 GG5Icw+Y/ZkeLJDv/HPhqE2I4b7D3TFZ54mkepj0qDUA6FwzOqEJW49HAUKufSi/E9l4 am6kahVlHxVKFH9dzFgPdCyBYjhzT76oWXaQknzLnT9wogYwWAT8SZ99DZzMCVrz1n+y yk7GCghzcwltDCpewMXHGCmLqGzOvfr/u/REY/g/JtHDPlq/D9qdz9jjSjydKgLuHLYv zsmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PSAR8amj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si2052320edq.579.2021.09.04.02.43.37; Sat, 04 Sep 2021 02:44:00 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PSAR8amj; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351137AbhIDJmE (ORCPT + 99 others); Sat, 4 Sep 2021 05:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbhIDJmD (ORCPT ); Sat, 4 Sep 2021 05:42:03 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D960C061575 for ; Sat, 4 Sep 2021 02:41:02 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id v123so1444339pfb.11 for ; Sat, 04 Sep 2021 02:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2CvcJSiEN9MNXuAzxJzwyEfnTU0mKkfe0+AjDJ9kifY=; b=PSAR8amj8SgeZssZ3i6aMhFnhx1d4yc7BYIy+eXaxcMCN1aRoV2VqqXOM2pmH1LvRh suidGUSlvYdrWD6WtmksppAQQejgzqMFdNY+FvjO2wKBY14MmY1LOB888gf890VzaV2I nTP5g2G8jyoBaDxBGJRLcDQ98Vvq67nwdzFCIbge+CWR77ynC61LFys+8KVF4qlIBI/U 3osF4Ki1nBsfaUgPkJ7opkfRy4sw6+tt2mY5fFzIoT4i/ZCfU51LENFPBxUD7MkJG+C8 W2A8sc/jgNGKU16m2bGUqCtY95b23dyuP4WZomR7tlXbXhUpd+fsXmuYtrmciKNqFgzN n1GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:cc:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2CvcJSiEN9MNXuAzxJzwyEfnTU0mKkfe0+AjDJ9kifY=; b=TendqE8SIpPDHej45IpLhYvaPWln5Hw680WjfTY4DLArRJx2rZYaKXX5yW36RQAzk9 i3t91YjGX+N0+XHLWxcz4GfL4V74Y24j/SL1emuV+/kXC+otXVBeLNbHJ20XQnqERhVG lVmNewbiL0RjF/ummR6IVeRBTDsbSdgQjeCX0nAnX6acCGM7LYWF+3qSNSf2OWET6ru8 xn771Xp/aJBEZekJBrgq2xeb02eh8eenzaNRfop7DuS5GBnxlT93/AZLdCH0BqH/p4E+ ofAv46UArejR1FpjJVvaZQVT8owwKFLDsbBisL2V9TPngmjHeRNiIZWgu2skOgx2VWtH DwZw== X-Gm-Message-State: AOAM531OehqRaRmhNN3nUWBGS3kLiXSf3B4fl6+/OZcx6CFhgj4V1H0g TIAgNmodydJ1OtgVplJvlP0uIMn5GfRIhg0d X-Received: by 2002:a63:ef58:: with SMTP id c24mr2902397pgk.299.1630748461514; Sat, 04 Sep 2021 02:41:01 -0700 (PDT) Received: from [192.168.1.6] ([117.98.200.228]) by smtp.gmail.com with ESMTPSA id d15sm1797118pfh.34.2021.09.04.02.40.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Sep 2021 02:41:00 -0700 (PDT) Cc: saurav.girepunje@hotmail.com, Larry Finger , Greg KH , Michael Straube , Martin Kaiser , "open list:STAGING SUBSYSTEM" , Linux Kernel Mailing List Subject: Re: [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy To: Phillip Potter References: From: Saurav Girepunje Message-ID: <52642929-cec1-d03b-03f1-130a54c0c289@gmail.com> Date: Sat, 4 Sep 2021 15:10:57 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/09/21 12:23 am, Phillip Potter wrote: > On Fri, 3 Sept 2021 at 18:56, Saurav Girepunje > wrote: >> >> Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c >> >> Signed-off-by: Saurav Girepunje >> --- >> drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c >> index 81d4255d1785..495fadd2b8c8 100644 >> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c >> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c >> @@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie >> } >> >> if (ielen) { >> - buf = kzalloc(ielen, GFP_KERNEL); >> + buf = kmemdup(pie, ielen, GFP_KERNEL); >> if (!buf) { >> ret = -ENOMEM; >> goto exit; >> } >> >> - memcpy(buf, pie, ielen); >> - >> /* dump */ >> { >> int i; >> -- >> 2.32.0 >> > > Dear Saurav, > > Looks good, thanks: > Acked-by: Phillip Potter > > Regards, > Phil > Thanks for review Phil Regards, Saurav Girepunje