[redhat-lspp] Re: [RFC 2/7] NetLabel: core network changes

Paul Moore paul.moore at hp.com
Mon Jul 10 14:56:32 UTC 2006


Steve Grubb wrote:
> On Thursday 06 July 2006 17:34, paul.moore at hp.com wrote:
> 
>>+++ linux-2.6.17.i686-quilt/include/net/cipso_ipv4.h
>>+int cipso_v4_doi_remove(const u32 doi,
>>+			void (*callback) (struct rcu_head * head));
>>+struct sk_buff *cipso_v4_doi_dump(const u32 doi, const size_t headroom);
>>*domain); 
> 
> You do not need to have const on pass by value vars.
> 

True, I agree it really doesn't matter from the perspective of the
machine but I think it can still be handy from the prespective of the
error prone people who try to write code for the machines.  I've seen
several cases of the const modifier used on scalar values elsewhere in
the kernel ...

>>+++ linux-2.6.17.i686-quilt/include/net/netlabel.h
>>+static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
>>+{
>>+	BUG_ON(secattr == NULL);
>>+	if (secattr->set_domain)
>>+		kfree(secattr->domain);
>>+	if (secattr->set_mls_cat)
>>+		kfree(secattr->mls_cat);
>>+	if (secattr->set_cache && secattr->cache.free)
>>+		secattr->cache.free(secattr->cache.data);
>  
> The 'if' statements are not needed. You can just kfree them.
>

Quick question - can you safely call kfree() on a NULL or uninitialized
pointer?

-- 
paul moore
linux security @ hp




More information about the redhat-lspp mailing list