Received: by 10.213.65.68 with SMTP id h4csp964643imn; Wed, 14 Mar 2018 05:47:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELv7ANgC0anF2SOTrGznNtEI1elnpAhG8BknAIbuHliebpmu+tAsLRPyiL2S6TU4z919zjTk X-Received: by 2002:a17:902:20c9:: with SMTP id v9-v6mr4080777plg.41.1521031646250; Wed, 14 Mar 2018 05:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521031646; cv=none; d=google.com; s=arc-20160816; b=f/qnvY9TqzO3X9XVVaLjgoSYTt7m2UUkpSGIZippLpMiFPh5FojYBirXDi6Pg7ho9E z3gwfDwxPHgqCFFp4fnmUYZ++hRivFSL272ylVExjfgSBCsIn07QAJimZu5L7QsxqXgE a5t/5N3An+6nsuL3FPydilEVMn4vKiHuxBfwxyAF8XZ1S7sRfmNj4ULCbdAh3U+vTeWt tpHy3T/jnyR/pYs94Vn6/pFHaLigTho5r3PdoQ3BlN8VURVARux8PJK7q31+WDScByaQ 7in8th0vc6duN3f+udXD3TpKAos6iargvRL65FddHUIDbjd1GQ+qpoSW4ufbPitUKBar snnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=YTCjNt1WHt1SF0BuPkr3vj/nKJ+JsYADQPQwogGW7Ss=; b=FoWNOyCGSyq2O0KUddB0y/F/FqI0u+naTQLsIOpf9BdusUMsL6HXAL6DOV3S5cSsGZ dH8HOCcz9r0lNGgDvEJeAKSFw4iKyKPWI6P1OMcdaaX7Lf/MwRYtlPzQYGyilQwfxMoy 2Wk6zR91vEAWecMnU6eiXf5papZrgD2o0xCQ8Yhwetw8HfQGjaMOhjgBiKQ3BYJncuho B+nhxnJyHkn7hUZsFa2gPe6Qh9T2G8krlAD3ns2d5Tau7DPBmXakON08KMX1U9HfO88c VWIVRTsy1Xvm69wqNAMu/QWGwa4uiP7U/Qb2TSZ0vp9MCzkT/1f08YIU9GtM8+zkJA/G Rysw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SJ1ODQNj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id n15-v6si1900741pll.42.2018.03.14.05.47.06; Wed, 14 Mar 2018 05:47:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@gmail.com header.s=20161025 header.b=SJ1ODQNj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1752261AbeCNMqA (ORCPT + 99 others); Wed, 14 Mar 2018 08:46:00 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35523 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbeCNMpz (ORCPT ); Wed, 14 Mar 2018 08:45:55 -0400 Received: by mail-pl0-f67.google.com with SMTP id w22-v6so1631674pll.2; Wed, 14 Mar 2018 05:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=YTCjNt1WHt1SF0BuPkr3vj/nKJ+JsYADQPQwogGW7Ss=; b=SJ1ODQNjz3s0MskJSBeFQqwIA4nN6K1FcxuMV4kDpSjMqQnO7KjvzTJbLJWdd8N5w1 n+yfDAyLATVD89e0mfw9UlyRt+tMAhSvGMTRiDSs6qShEikWt0R5s5H7CJmjH586pCam 494IrgiM0aJo00d4lJKd6iQkHwBOZJFJXBkS7jDTHMveEI60rBXdlgXpHX0lE6a5qYcG 66L33VVP/45Wd7hK3fRsbCdSSu3JRDR/DTQxjJOZzJxsCw+ZrTXO36XV6dfWRRIcerIi /O3tCt/6J0ZqQZdbBnGPO0vLufEf/PDnzWNZRQJHAe/1CNbz88mq7fUbXlJogevma8/i SVRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=YTCjNt1WHt1SF0BuPkr3vj/nKJ+JsYADQPQwogGW7Ss=; b=g/syD/fqJtclukdxS9FV9jYwrx/EdYI/Vt84MAKHflbAuk0tQ3cfRmnFiNtarVM196 QkPCGQz4Cvv+3twMqYgJslBHzGlQX4B4rGFUEQqEfKqbmHs+uMeCu4ouyhOJH08n8SBg DSW138olK9wOgb6WKTZfiH7hrhFPT94WHrxG+B3IcQZbTI3MoWBkfwuuuDkJ3bLxHlFM fnzX9nYkrVEa3EV7s++EYmoUaz1AYnuRDm9WtBd0Nl0yFDvc+o+vE6J7ZffmvKm662ox Wf+/TGE8SaFtNM+3fxDJUYUAmdtRqMXO6cpp3snJeBbnzT2FVwimHHv+3eQLIntD8/kw dWcA== X-Gm-Message-State: AElRT7EVea5isgPWwN5CcquKzLd+0BKy8LAKFu5bPw6WGJ1vq7cgbCpC Qdc/gEtQqxgZqgAo4i1pn27831Fx X-Received: by 2002:a17:902:7d93:: with SMTP id a19-v6mr4053053plm.160.1521031555272; Wed, 14 Mar 2018 05:45:55 -0700 (PDT) Received: from localhost.localdomain ([2405:204:7142:9212:3d49:8166:4647:f07f]) by smtp.gmail.com with ESMTPSA id y14sm3999982pff.81.2018.03.14.05.45.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 05:45:54 -0700 (PDT) From: hariprasath.elango@gmail.com To: aditya.shankar@microchip.com, gregkh@linuxfoundation.org, ganesh.krishna@microchip.com Cc: hariprasath.elango@gmail.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] staging: wilc1000: use kmemdup to replace kmalloc/memcpy Date: Wed, 14 Mar 2018 18:15:05 +0530 Message-Id: X-Mailer: git-send-email 2.10.0.GIT In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: HariPrasath Elango kmalloc followed by memcpy can be replaced by kmemdup.Also added the related error handling part Signed-off-by: HariPrasath Elango --- drivers/staging/wilc1000/host_interface.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0fac8e1..4ae2da6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -992,9 +992,13 @@ static s32 handle_connect(struct wilc_vif *vif, if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { info_element_size = hif_drv->usr_conn_req.ies_len; - info_element = kmalloc(info_element_size, GFP_KERNEL); - memcpy(info_element, hif_drv->usr_conn_req.ies, - info_element_size); + info_element = kmemdup(hif_drv->usr_conn_req.ies, + info_element_size, + GFP_KERNEL); + if (!info_element) { + result = -ENOMEM; + goto ERRORHANDLER; + } } wid_list[wid_cnt].id = (u16)WID_11I_MODE; -- 2.10.0.GIT