Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261303AbVCVPjf (ORCPT ); Tue, 22 Mar 2005 10:39:35 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261382AbVCVPje (ORCPT ); Tue, 22 Mar 2005 10:39:34 -0500 Received: from mx1.redhat.com ([66.187.233.31]:7874 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S261303AbVCVPet (ORCPT ); Tue, 22 Mar 2005 10:34:49 -0500 From: David Howells In-Reply-To: References: To: Jesper Juhl Cc: linux-kernel , Stephen Smalley , Chris Vance , Wayne Salamon , James Morris , dgoeddel@trustedcs.com, Karl MacMillan , Frank Mayer , selinux@tycho.nsa.gov, Andrew Morton Subject: Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/ X-Mailer: MH-E 7.82; nmh 1.0.4; GNU Emacs 21.3.50.1 Date: Tue, 22 Mar 2005 15:34:26 +0000 Message-ID: <9581.1111505666@redhat.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1144 Lines: 33 Jesper Juhl wrote: > --- linux-2.6.11-mm4-orig/security/keys/key.c 2005-03-16 15:45:42.000000000 +0100 > +++ linux-2.6.11-mm4/security/keys/key.c 2005-03-20 12:40:19.000000000 +0100 > ... > - if (candidate) > - kfree(candidate); > + kfree(candidate); Looks okay to me. It's probably less efficient though, but more space efficient. > --- linux-2.6.11-mm4-orig/security/keys/user_defined.c 2005-03-16 15:45:42.000000000 +0100 > +++ linux-2.6.11-mm4/security/keys/user_defined.c 2005-03-20 12:41:54.000000000 +0100 > @@ -182,9 +182,7 @@ static int user_match(const struct key * > */ > static void user_destroy(struct key *key) > { > - struct user_key_payload *upayload = key->payload.data; > - > - kfree(upayload); > + kfree(key->payload.data); There's a patch in Andrew Morton's tree that changes this to make use of RCU, so I'd prefer you didn't do this just yet. David - 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/