s390/ctlreg: add type checking to __local_ctl_load() and __local_ctl_store()
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 11 Sep 2023 19:40:03 +0000 (21:40 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 19 Sep 2023 11:26:56 +0000 (13:26 +0200)
Add type checking to __local_ctl_load() and __local_ctl_store(). For
both functions enforce to pass an array consisting of unsigned longs.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/ctlreg.h

index e60c672ffb9c4421ceb387e0ba47ae6988b9bf0b..a49459adba9d7240d7d4d23c9aaa09b292bd10c6 100644 (file)
@@ -45,6 +45,7 @@
                                                                        \
        _esize = (_high - _low + 1) * sizeof(unsigned long);            \
        BUILD_BUG_ON(sizeof(struct addrtype) != _esize);                \
+       typecheck(unsigned long, array[0]);                             \
        asm volatile(                                                   \
                "       lctlg   %[_low],%[_high],%[_arr]\n"             \
                :                                                       \
@@ -63,6 +64,7 @@
                                                                        \
        _esize = (_high - _low + 1) * sizeof(unsigned long);            \
        BUILD_BUG_ON(sizeof(struct addrtype) != _esize);                \
+       typecheck(unsigned long, array[0]);                             \
        asm volatile(                                                   \
                "       stctg   %[_low],%[_high],%[_arr]\n"             \
                : [_arr] "=Q" (*(struct addrtype *)(&array))            \