提交 12e13266 编写于 作者: C Christian Borntraeger 提交者: Greg Kroah-Hartman

s390/uaccess: avoid (false positive) compiler warnings

[ Upstream commit 062795fcdcb2d22822fb42644b1d76a8ad8439b3 ]

Depending on inlining decisions by the compiler, __get/put_user_fn
might become out of line. Then the compiler is no longer able to tell
that size can only be 1,2,4 or 8 due to the check in __get/put_user
resulting in false positives like

./arch/s390/include/asm/uaccess.h: In function ‘__put_user_fn’:
./arch/s390/include/asm/uaccess.h:113:9: warning: ‘rc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  113 |  return rc;
      |         ^~
./arch/s390/include/asm/uaccess.h: In function ‘__get_user_fn’:
./arch/s390/include/asm/uaccess.h:143:9: warning: ‘rc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  143 |  return rc;
      |         ^~

These functions are supposed to be always inlined. Mark it as such.
Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 da24be88
...@@ -84,7 +84,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n); ...@@ -84,7 +84,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n);
__rc; \ __rc; \
}) })
static inline int __put_user_fn(void *x, void __user *ptr, unsigned long size) static __always_inline int __put_user_fn(void *x, void __user *ptr, unsigned long size)
{ {
unsigned long spec = 0x010000UL; unsigned long spec = 0x010000UL;
int rc; int rc;
...@@ -114,7 +114,7 @@ static inline int __put_user_fn(void *x, void __user *ptr, unsigned long size) ...@@ -114,7 +114,7 @@ static inline int __put_user_fn(void *x, void __user *ptr, unsigned long size)
return rc; return rc;
} }
static inline int __get_user_fn(void *x, const void __user *ptr, unsigned long size) static __always_inline int __get_user_fn(void *x, const void __user *ptr, unsigned long size)
{ {
unsigned long spec = 0x01UL; unsigned long spec = 0x01UL;
int rc; int rc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册