From patchwork Thu Jun 10 07:59:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 55163 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B7C66B7D1C for ; Thu, 10 Jun 2010 17:59:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758536Ab0FJH70 (ORCPT ); Thu, 10 Jun 2010 03:59:26 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:58364 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752396Ab0FJH7Y (ORCPT ); Thu, 10 Jun 2010 03:59:24 -0400 Received: by wwb18 with SMTP id 18so203585wwb.19 for ; Thu, 10 Jun 2010 00:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=jxHbWEjqKSe5F2p4+W0KnyF7UvHUP8dmpNm879NaIrk=; b=U6V340H/Olbx9fZ3HCTxbtgb6AXKmXKWbwIdY5Fr+W7kqPS5GggdmdL6PS27tBJjuG e8+AD/lyk3+WClp0ydC+/NgLOaRuoTXCxx/y8qBKrub2XcetQo5Ux3yKiOpa2R27ll6F C9ksQ+Yka3kbyVakibyvXn06lbxhU3N/cHa+4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=EYVdeGQnGpTcsrX9UcLOabvu+XbLf3eqyslDuIK82R7u7QpZSH4DaTYsu1eJOF+eZS s6O+QtTvLt8BKIDBoqb14yzPLQTMxfhFheIn5sUu8oz1VeFWbsPLI880GiiFrorDNjXq fBKZZfK75Cxo6KI7epj2i8rYsZlCmoeHHexBE= Received: by 10.227.144.143 with SMTP id z15mr4174963wbu.75.1276156757865; Thu, 10 Jun 2010 00:59:17 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id h1sm3258686wee.7.2010.06.10.00.59.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 10 Jun 2010 00:59:17 -0700 (PDT) Date: Thu, 10 Jun 2010 09:59:03 +0200 From: Dan Carpenter To: Scott Feldman Cc: Vasanthy Kolluri , Roopa Prabhu , netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] enic: cleanup vic_provinfo_alloc() Message-ID: <20100610075903.GL5483@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If oui were a null variable then vic_provinfo_alloc() would leak memory. But this function is only called from one place and oui is not null so I removed the check. I also moved the memory allocation down a line so it was easier to spot. (No one ever reads variable declarations). Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/enic/vnic_vic.c b/drivers/net/enic/vnic_vic.c index d769772..0a35085 100644 --- a/drivers/net/enic/vnic_vic.c +++ b/drivers/net/enic/vnic_vic.c @@ -25,9 +25,10 @@ struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, u8 *oui, u8 type) { - struct vic_provinfo *vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags); + struct vic_provinfo *vp; - if (!vp || !oui) + vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags); + if (!vp) return NULL; memcpy(vp->oui, oui, sizeof(vp->oui));