From patchwork Sun Oct 17 19:55:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 260511 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9HJtSZ4006877 for ; Sun, 17 Oct 2010 19:55:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932625Ab0JQTzY (ORCPT ); Sun, 17 Oct 2010 15:55:24 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:47806 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932613Ab0JQTzY (ORCPT ); Sun, 17 Oct 2010 15:55:24 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 7E20F19BB5E; Sun, 17 Oct 2010 21:55:22 +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 17101-06; Sun, 17 Oct 2010 21:55:21 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 5F2B619BB45; Sun, 17 Oct 2010 21:55:21 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 1857A6DF823; Sun, 17 Oct 2010 21:52:17 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id 3DC992085D; Sun, 17 Oct 2010 21:55:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 27E0A2085C; Sun, 17 Oct 2010 21:55:21 +0200 (CEST) Date: Sun, 17 Oct 2010 21:55:21 +0200 (CEST) From: Julia Lawall To: Joe Perches Cc: Sage Weil , kernel-janitors@vger.kernel.org, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] fs/ceph/xattr.c: Use kmemdup In-Reply-To: <1287341657.20968.61.camel@Joe-Laptop> Message-ID: References: <1287341311-11161-1-git-send-email-julia@diku.dk> <1287341311-11161-3-git-send-email-julia@diku.dk> <1287341657.20968.61.camel@Joe-Laptop> MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 17 Oct 2010 19:55:29 +0000 (UTC) diff -u -p a/fs/ceph/xattr.c b/fs/ceph/xattr.c --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -716,10 +716,9 @@ int ceph_setxattr(struct dentry *dentry, /* preallocate memory for xattr name, value, index node */ err = -ENOMEM; - newname = kmalloc(name_len + 1, GFP_NOFS); + newname = kmemdup(name, name_len + 1, GFP_NOFS); if (!newname) goto out; - memcpy(newname, name, name_len + 1); if (val_len) { newval = kmalloc(val_len + 1, GFP_NOFS);