[redhat-lspp] Re: [RFC 4/7] NetLabel: core NetLabel subsystem
Steve Grubb
sgrubb at redhat.com
Sat Jul 8 15:45:57 UTC 2006
On Thursday 06 July 2006 17:34, paul.moore at hp.com wrote:
> +++ linux-2.6.17.i686-quilt/net/netlabel/netlabel_domainhash.c
> +static void netlbl_domhsh_free_entry(struct rcu_head *entry)
> +{
> + struct netlbl_dom_map *ptr;
> +
> + ptr = container_of(entry, struct netlbl_dom_map, rcu);
> + if (ptr->domain)
> + kfree(ptr->domain);
'if' not needed
> +static u32 netlbl_domhsh_hash(const char *domain)
> +{
> + char *p;
> + char *keyp = (char *)domain;
both of these could be const to avoid casting to char *.
> +int netlbl_domhsh_init(const u32 size)
const on pbv
> +{
> + u32 iter;
> + struct netlbl_domhsh_tbl *hsh_tbl;
> +
> + if (size <= 0)
> + return -EINVAL;
size can't be < 0...so this test is really (size == 0)
> +void netlbl_domhsh_exit(void)
> +{
<snip>
> + kfree(hsh_tbl->tbl);
> + kfree(hsh_tbl);
> +
> + return;
> +}
You don't need a return at the end of the function
> +int netlbl_domhsh_add(struct netlbl_dom_map *entry)
> +{
<snip>
> + } else if (entry->domain == NULL &&
> + rcu_dereference(netlbl_domhsh_def) == NULL) {
> + INIT_LIST_HEAD(&entry->list);
looks like indentation change
> +struct sk_buff *netlbl_domhsh_dump(const size_t headroom)
const on pbv
> +{
> + struct sk_buff *skb;
> + unsigned char *buf;
> + ssize_t buf_len;
indentation
> Index: linux-2.6.17.i686-quilt/net/netlabel/netlabel_kapi.c
> ===================================================================
> --- /dev/null
> +++ linux-2.6.17.i686-quilt/net/netlabel/netlabel_kapi.c
> +void netlbl_socket_inet_accept(struct socket *sock, struct socket
> *newsock)
> +{
<snip>
> + if (cipso_v4_socket_getopt(sock, &opt, &opt_len) == 0 &&
> + cipso_v4_socket_setopt(newsock, opt, opt_len) != 0)
> + printk(KERN_ERR
> + "NetLabel: failed to set the CIPSOv4 option on a kernel"
> + " socket\n");
> +
> + return;
> +}
return not needed at end of function
> Index: linux-2.6.17.i686-quilt/net/netlabel/netlabel_mgmt.c
> ===================================================================
> --- /dev/null
> +++ linux-2.6.17.i686-quilt/net/netlabel/netlabel_mgmt.c
> +static void netlbl_mgmt_send_ack(const struct genl_info *info,
> + const u32 ret_code);
const on pbv
> +static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
> +{
<snip>
> +add_failure:
> + if (entry) {
this is needed...
> + if (entry->domain)
> + kfree(entry->domain);
but 'if' not needed here
> + kfree(entry);
> + }
> +static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info)
> +{
<snip>
> +adddef_failure:
> + if (entry)
> + kfree(entry);
'if' not needed
> +static int netlbl_mgmt_modules(struct sk_buff *skb, struct genl_info
> *info) +{
<snip>
> +modules_failure:
> + if (ans_skb)
> + kfree_skb(ans_skb);
'if' not needed
> +static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info
> *info) +{
<snip>
> +version_failure:
> + if (ans_skb)
> + kfree_skb(ans_skb);
same
> +static void netlbl_mgmt_send_ack(const struct genl_info *info,
> + const u32 ret_code)
const on pbv
> Index: linux-2.6.17.i686-quilt/net/netlabel/netlabel_user.c
> ===================================================================
> +int netlbl_netlink_snd(struct sk_buff *skb, const u32 pid)
const on pbv
> +int netlbl_netlink_snd_multicast(struct sk_buff *skb,
> + const u32 pid,
> + const u32 group)
same
> Index: linux-2.6.17.i686-quilt/net/netlabel/netlabel_user.h
> ===================================================================
> --- /dev/null
> +++ linux-2.6.17.i686-quilt/net/netlabel/netlabel_user.h
> +static inline int netlbl_netlink_cap_check(const struct sk_buff *skb,
> + const kernel_cap_t req_cap)
same
> +static inline void __netlbl_netlink_hdr(unsigned char *buffer,
> + const u32 pid,
> + const u32 seq,
> + const int flags,
> + const int type,
> + const u8 cmd,
> + const int len)
same
> +static inline unsigned char *netlbl_netlink_hdr_put(struct sk_buff *skb,
> + const u32 pid,
> + const u32 seq,
> + const int flags,
> + const int type,
> + const u8 cmd,
> + const int len)
same
-Steve
More information about the redhat-lspp
mailing list