[lkml]   [2013]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] kernel/groups.c: consider about NULL for 'group_info' in all related extern functions

(I have no idea about this but Andrew tagged me, probably thinking it
was related to cgroups, so here it goes ;)

On Tue, Aug 20, 2013 at 11:01:14AM +0800, Chen Gang wrote:
> groups_alloc() can return NULL for 'group_info', also group_search()
> already considers about NULL for 'group_info', so can assume the caller
> has right to use all related extern functions when 'group_info' is NULL.
> For groups_free(), need check NULL to match groups_alloc(), just like
> kmalloc/free().

While it is somewhat customary to make free routines handle NULL
inputs, the convention isn't a very strong one and given that the
above change doesn't actually benefit any of the existing use cases,
it seems gratuituous.

> For set_groups(), can allow the caller to set NULL parameter to new
> 'cred'.
> For system call getgroups(), if 'cred->group_info' is NULL, need return
> the related error code (no related data), also need change the related
> man page ("man 2 getgroups") to complete the return value.

How can cred->group_info be NULL? Can you please describe what issue
this patch is trying to solve / improve? The patch description
explains what's being changed but doesn't really offer why such
changes are being made. Can you please explain why this change is



 \ /
  Last update: 2013-09-23 17:21    [W:0.102 / U:1.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site