dlm: remove __user conversion warnings
This patch avoids the following sparse warning: fs/dlm/user.c:111:38: warning: incorrect type in assignment (different address spaces) fs/dlm/user.c:111:38: expected void [noderef] __user *castparam fs/dlm/user.c:111:38: got void * fs/dlm/user.c:112:37: warning: incorrect type in assignment (different address spaces) fs/dlm/user.c:112:37: expected void [noderef] __user *castaddr fs/dlm/user.c:112:37: got void * fs/dlm/user.c:113:38: warning: incorrect type in assignment (different address spaces) fs/dlm/user.c:113:38: expected void [noderef] __user *bastparam fs/dlm/user.c:113:38: got void * fs/dlm/user.c:114:37: warning: incorrect type in assignment (different address spaces) fs/dlm/user.c:114:37: expected void [noderef] __user *bastaddr fs/dlm/user.c:114:37: got void * fs/dlm/user.c:115:33: warning: incorrect type in assignment (different address spaces) fs/dlm/user.c:115:33: expected struct dlm_lksb [noderef] __user *lksb fs/dlm/user.c:115:33: got void * fs/dlm/user.c:130:39: warning: cast removes address space '__user' of expression fs/dlm/user.c:131:40: warning: cast removes address space '__user' of expression fs/dlm/user.c:132:36: warning: cast removes address space '__user' of expression So far I see there is no direct handling of copying a pointer value to another pointer value. The handling only copies the actual pointer address to a scalar type or vice versa. This should be okay because it never handles dereferencing anything of those addresses in the kernel space. To get rid of those warnings we doing some different casting which results in no warnings in sparse or compiler. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
Родитель
14a92fd703
Коммит
c087eabde1
|
@ -108,11 +108,11 @@ static void compat_input(struct dlm_write_request *kb,
|
|||
kb->i.lock.parent = kb32->i.lock.parent;
|
||||
kb->i.lock.xid = kb32->i.lock.xid;
|
||||
kb->i.lock.timeout = kb32->i.lock.timeout;
|
||||
kb->i.lock.castparam = (void *)(long)kb32->i.lock.castparam;
|
||||
kb->i.lock.castaddr = (void *)(long)kb32->i.lock.castaddr;
|
||||
kb->i.lock.bastparam = (void *)(long)kb32->i.lock.bastparam;
|
||||
kb->i.lock.bastaddr = (void *)(long)kb32->i.lock.bastaddr;
|
||||
kb->i.lock.lksb = (void *)(long)kb32->i.lock.lksb;
|
||||
kb->i.lock.castparam = (__user void *)(long)kb32->i.lock.castparam;
|
||||
kb->i.lock.castaddr = (__user void *)(long)kb32->i.lock.castaddr;
|
||||
kb->i.lock.bastparam = (__user void *)(long)kb32->i.lock.bastparam;
|
||||
kb->i.lock.bastaddr = (__user void *)(long)kb32->i.lock.bastaddr;
|
||||
kb->i.lock.lksb = (__user void *)(long)kb32->i.lock.lksb;
|
||||
memcpy(kb->i.lock.lvb, kb32->i.lock.lvb, DLM_USER_LVB_LEN);
|
||||
memcpy(kb->i.lock.name, kb32->i.lock.name, namelen);
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ static void compat_output(struct dlm_lock_result *res,
|
|||
res32->version[1] = res->version[1];
|
||||
res32->version[2] = res->version[2];
|
||||
|
||||
res32->user_astaddr = (__u32)(long)res->user_astaddr;
|
||||
res32->user_astparam = (__u32)(long)res->user_astparam;
|
||||
res32->user_lksb = (__u32)(long)res->user_lksb;
|
||||
res32->user_astaddr = (__u32)(__force long)res->user_astaddr;
|
||||
res32->user_astparam = (__u32)(__force long)res->user_astparam;
|
||||
res32->user_lksb = (__u32)(__force long)res->user_lksb;
|
||||
res32->bast_mode = res->bast_mode;
|
||||
|
||||
res32->lvb_offset = res->lvb_offset;
|
||||
|
|
Загрузка…
Ссылка в новой задаче