From patchwork Sat May 15 21:22:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 99911 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4FLNasY016966 for ; Sat, 15 May 2010 21:23:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756532Ab0EOVWp (ORCPT ); Sat, 15 May 2010 17:22:45 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:35472 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755331Ab0EOVWn (ORCPT ); Sat, 15 May 2010 17:22:43 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id E8F7A19BB80; Sat, 15 May 2010 23:22:42 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08566-07; Sat, 15 May 2010 23:22:38 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id CB50D19BB6D; Sat, 15 May 2010 23:22:38 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 505516DFD25; Sat, 15 May 2010 23:15:27 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id AFFC2200BE; Sat, 15 May 2010 23:22:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id A6DB6200BC; Sat, 15 May 2010 23:22:38 +0200 (CEST) Date: Sat, 15 May 2010 23:22:38 +0200 (CEST) From: Julia Lawall To: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 31/37] drivers/infiniband/core: Use kmemdup Message-ID: MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 15 May 2010 21:23:37 +0000 (UTC) diff -u -p a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -1676,13 +1676,13 @@ int rdma_set_ib_paths(struct rdma_cm_id if (!cma_comp_exch(id_priv, CMA_ADDR_RESOLVED, CMA_ROUTE_RESOLVED)) return -EINVAL; - id->route.path_rec = kmalloc(sizeof *path_rec * num_paths, GFP_KERNEL); + id->route.path_rec = kmemdup(path_rec, sizeof *path_rec * num_paths, + GFP_KERNEL); if (!id->route.path_rec) { ret = -ENOMEM; goto err; } - memcpy(id->route.path_rec, path_rec, sizeof *path_rec * num_paths); id->route.num_paths = num_paths; return 0; err: diff -u -p a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -291,13 +291,11 @@ struct ib_mad_agent *ib_register_mad_age } if (mad_reg_req) { - reg_req = kmalloc(sizeof *reg_req, GFP_KERNEL); + reg_req = kmemdup(mad_reg_req, sizeof *reg_req, GFP_KERNEL); if (!reg_req) { ret = ERR_PTR(-ENOMEM); goto error3; } - /* Make a copy of the MAD registration request */ - memcpy(reg_req, mad_reg_req, sizeof *reg_req); } /* Now, fill in the various structures */