Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753350AbbFUK3V (ORCPT ); Sun, 21 Jun 2015 06:29:21 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:25845 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751320AbbFUK3P (ORCPT ); Sun, 21 Jun 2015 06:29:15 -0400 X-IronPort-AV: E=Sophos;i="5.13,653,1427752800"; d="scan'208";a="137211258" Date: Sun, 21 Jun 2015 12:29:12 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: walter harms cc: Julia Lawall , Oleg Drokin , kernel-janitors@vger.kernel.org, Andreas Dilger , Greg Kroah-Hartman , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/12] staging: lustre: obdclass: Use !x to check for kzalloc failure In-Reply-To: <55868BCE.4060803@bfs.de> Message-ID: References: <1434819550-3193-1-git-send-email-Julia.Lawall@lip6.fr> <1434819550-3193-10-git-send-email-Julia.Lawall@lip6.fr> <55868BCE.4060803@bfs.de> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 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: 573 Lines: 18 > > @@ -885,7 +885,7 @@ static int lmd_parse_mgssec(struct lustr > > length = tail - ptr; > > > > lmd->lmd_mgssec = kzalloc(length + 1, GFP_NOFS); > > - if (lmd->lmd_mgssec == NULL) > > + if (!lmd->lmd_mgssec) > > return -ENOMEM; > > > > memcpy(lmd->lmd_mgssec, ptr, length); > looks like memdup() kmemdup has the same length for both calls. There is kstrndup, but it recalculates the length, which looks unnecessary here. julia -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/