From patchwork Thu Oct 29 12:29:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 7518771 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D3699F37F for ; Thu, 29 Oct 2015 12:30:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC4572072B for ; Thu, 29 Oct 2015 12:30:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D51552070D for ; Thu, 29 Oct 2015 12:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750955AbbJ2MaP (ORCPT ); Thu, 29 Oct 2015 08:30:15 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35397 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbbJ2MaN (ORCPT ); Thu, 29 Oct 2015 08:30:13 -0400 Received: by pasz6 with SMTP id z6so40016799pas.2 for ; Thu, 29 Oct 2015 05:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lRMW+extGrpjCqhv/kqs0RGoMR89l2pLuEJAh+UR3dY=; b=G5dsmPlUsDbJfntnuMrVh687jmZdp+E6vOjTfbLdap23GXU3izHqofH8uI9dz5YkLT UMsVJ6F0wJEMS4Alm0pQoAAoK9VfSnFQNX9VDxxJcWf+l8U+6qSaEIKnTKwkSVflBYJj s/GuZubtXGSmELOWiszvcCqwjxNDTol6rYeQzWNiXLaqsVHgmDAhNbPAGFY+jwGdRCnm dr4eBvOpj1G2gxTQIAQlehaNEj62WFcVaQWqcBIAuSfpbvX1SMftBrJjI7NNblNMaO/V ao4wPcdQDHH5nvMSPuYPmIFURS1TRTx4v5wMm26ER0JHm8vOzbnogKpXUJq0Wj53pjSj Y1bQ== X-Received: by 10.68.69.72 with SMTP id c8mr1696615pbu.2.1446121813429; Thu, 29 Oct 2015 05:30:13 -0700 (PDT) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id ir4sm2139226pbb.93.2015.10.29.05.30.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 05:30:12 -0700 (PDT) From: Chaehyun Lim To: gregkh@linuxfoundation.org Cc: johnny.kim@atmel.com, austin.shin@atmel.com, chris.park@atmel.com, tony.cho@atmel.com, glen.lee@atmel.com, leo.kim@atmel.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Chaehyun Lim Subject: [PATCH 11/12] staging: use kmemdup in host_int_add_station Date: Thu, 29 Oct 2015 21:29:27 +0900 Message-Id: <1446121768-4953-11-git-send-email-chaehyun.lim@gmail.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1446121768-4953-1-git-send-email-chaehyun.lim@gmail.com> References: <1446121768-4953-1-git-send-email-chaehyun.lim@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replaces kmalloc followed by memcpy with kmemdup. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3c5de75..6b804e6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4537,12 +4537,12 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->u8NumRates > 0) { - u8 *rates = kmalloc(add_sta_info->u8NumRates, GFP_KERNEL); - + u8 *rates = kmemdup(sta_param->pu8Rates, + add_sta_info->u8NumRates, + GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, sta_param->pu8Rates, add_sta_info->u8NumRates); add_sta_info->pu8Rates = rates; }