From patchwork Mon Jul 4 10:29:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Raiger X-Patchwork-Id: 103082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5880EB6F6E for ; Mon, 4 Jul 2011 20:30:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EE1442809D; Mon, 4 Jul 2011 12:30:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MJuPUFgzvPCy; Mon, 4 Jul 2011 12:30:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CF7932809E; Mon, 4 Jul 2011 12:30:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 68B4B2809B for ; Mon, 4 Jul 2011 12:30:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RU170EQv4S2K for ; Mon, 4 Jul 2011 12:30:13 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx.inode.at (mx04.lb01.inode.at [62.99.145.4]) by theia.denx.de (Postfix) with ESMTPS id 045172809D for ; Mon, 4 Jul 2011 12:30:09 +0200 (CEST) Received: from [83.64.51.210] (port=8997 helo=gateway1.hale) by smartmx-04.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1QdgPp-0002Eg-Kz; Mon, 04 Jul 2011 12:30:09 +0200 Received: from mail1.hale.at (mail2.hale [192.168.100.12]) by gateway1.hale (8.13.8/8.13.7) with ESMTP id p64AU410002970; Mon, 4 Jul 2011 12:30:04 +0200 Received: from uni24.HALE ([192.168.100.40]) by hale.at with MailEnable ESMTP; Mon, 4 Jul 2011 12:30:01 +0200 From: helmut.raiger@hale.at To: u-boot@lists.denx.de Date: Mon, 4 Jul 2011 12:29:51 +0200 Message-Id: <1309775392-8282-1-git-send-email-helmut.raiger@hale.at> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <4E118AD9.9000200@hale.at> References: <4E118AD9.9000200@hale.at> MIME-Version: 1.0 X-HALE-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: p64AU410002970 X-HALE-MailScanner: Found to be clean X-HALE-MailScanner-From: helmut.raiger@hale.at MailScanner-NULL-Check: 1310380205.85466@gReJRnzfMHnDtEbshDgofw Subject: [U-Boot] [PATCH 1/2] net/eth.c: make eth_get_dev_by_name(NULL) safe X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Helmut Raiger eth_get_dev_by_name() is not safe to use for devname being NULL as it uses strcmp. This patch makes it return NULL if devname NULL is passed. Signed-off-by: Helmut Raiger Acked-by: Detlev Zundel --- net/eth.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/eth.c b/net/eth.c index 6523834..c75b7c9 100644 --- a/net/eth.c +++ b/net/eth.c @@ -107,7 +107,7 @@ struct eth_device *eth_get_dev_by_name(const char *devname) { struct eth_device *dev, *target_dev; - if (!eth_devices) + if (!eth_devices || !devname) return NULL; dev = eth_devices;