Showing error 1903

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: net/sunrpc/auth_unix.c
Line in file: 82
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

 52 */
 53static struct rpc_cred *
 54unx_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
 55{
 56        return rpcauth_lookup_credcache(auth, acred, flags);
 57}
 58
 59static struct rpc_cred *
 60unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
 61{
 62        struct unx_cred        *cred;
 63        unsigned int groups = 0;
 64        unsigned int i;
 65
 66        dprintk("RPC:       allocating UNIX cred for uid %d gid %d\n",
 67                        acred->uid, acred->gid);
 68
 69        if (!(cred = kmalloc(sizeof(*cred), GFP_NOFS)))
 70                return ERR_PTR(-ENOMEM);
 71
 72        rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops);
 73        cred->uc_base.cr_flags = 1UL << RPCAUTH_CRED_UPTODATE;
 74
 75        if (acred->group_info != NULL)
 76                groups = acred->group_info->ngroups;
 77        if (groups > NFS_NGROUPS)
 78                groups = NFS_NGROUPS;
 79
 80        cred->uc_gid = acred->gid;
 81        for (i = 0; i < groups; i++)
 82                cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
 83        if (i < NFS_NGROUPS)
 84                cred->uc_gids[i] = NOGROUP;
 85
 86        return &cred->uc_base;
 87}
 88
 89static void
 90unx_free_cred(struct unx_cred *unx_cred)
 91{
 92        dprintk("RPC:       unx_free_cred %p\n", unx_cred);
Show full sources