Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761530Ab3DBJXj (ORCPT ); Tue, 2 Apr 2013 05:23:39 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56341 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760318Ab3DBJXh (ORCPT ); Tue, 2 Apr 2013 05:23:37 -0400 Date: Tue, 02 Apr 2013 11:23:36 +0200 Message-ID: From: Takashi Iwai To: Alexandru Gheorghiu Cc: Jaroslav Kysela , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy In-Reply-To: <1364219434-11920-1-git-send-email-gheorghiuandru@gmail.com> References: <1364219434-11920-1-git-send-email-gheorghiuandru@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.2 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1347 Lines: 46 At Mon, 25 Mar 2013 15:50:34 +0200, Alexandru Gheorghiu wrote: > > Used kmemdup instead of replicating it's behaviour with kmalloc followed > by memcpy. > Patch found using coccinelle. > > Signed-off-by: Alexandru Gheorghiu Thanks, applied. Takashi > --- > sound/oss/sb_common.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c > index 7d42c54..851a1da 100644 > --- a/sound/oss/sb_common.c > +++ b/sound/oss/sb_common.c > @@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_ > */ > > > - detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL); > + detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL); > if (detected_devc == NULL) > { > printk(KERN_ERR "sb: Can't allocate memory for device information\n"); > return 0; > } > - memcpy(detected_devc, devc, sizeof(sb_devc)); > MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base)); > return 1; > } > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/