Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390: proper type casts for csum_partial invocations

Keep sparse and other static code checkers from emitting warnings like:

arch/s390/kernel/ipl.c:1549:14: warning: incorrect type in assignment (different base types)
arch/s390/kernel/ipl.c:1549:14: expected unsigned int [unsigned] csum
arch/s390/kernel/ipl.c:1549:14: got restricted __wsum

All usages in s390 code are ok. Therefore add proper casts.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Heiko Carstens and committed by
Martin Schwidefsky
90b3baa2 dd695546

+6 -5
+2 -1
arch/s390/kernel/ipl.c
··· 1546 1546 unsigned long ipib = (unsigned long) reipl_block_actual; 1547 1547 unsigned int csum; 1548 1548 1549 - csum = csum_partial(reipl_block_actual, reipl_block_actual->hdr.len, 0); 1549 + csum = (__force unsigned int) 1550 + csum_partial(reipl_block_actual, reipl_block_actual->hdr.len, 0); 1550 1551 mem_assign_absolute(S390_lowcore.ipib, ipib); 1551 1552 mem_assign_absolute(S390_lowcore.ipib_checksum, csum); 1552 1553 dump_run(trigger);
+3 -3
arch/s390/kernel/os_info.c
··· 26 26 u32 os_info_csum(struct os_info *os_info) 27 27 { 28 28 int size = sizeof(*os_info) - offsetof(struct os_info, version_major); 29 - return csum_partial(&os_info->version_major, size, 0); 29 + return (__force u32)csum_partial(&os_info->version_major, size, 0); 30 30 } 31 31 32 32 /* ··· 46 46 { 47 47 os_info.entry[nr].addr = (u64)(unsigned long)ptr; 48 48 os_info.entry[nr].size = size; 49 - os_info.entry[nr].csum = csum_partial(ptr, size, 0); 49 + os_info.entry[nr].csum = (__force u32)csum_partial(ptr, size, 0); 50 50 os_info.csum = os_info_csum(&os_info); 51 51 } 52 52 ··· 93 93 msg = "copy failed"; 94 94 goto fail_free; 95 95 } 96 - csum = csum_partial(buf_align, size, 0); 96 + csum = (__force u32)csum_partial(buf_align, size, 0); 97 97 if (csum != os_info_old->entry[nr].csum) { 98 98 msg = "checksum failed"; 99 99 goto fail_free;
+1 -1
drivers/s390/char/zcore.c
··· 272 272 rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE); 273 273 else 274 274 rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE); 275 - if (rc || csum_partial(ipl_block, ipl_block->hdr.len, 0) != 275 + if (rc || (__force u32)csum_partial(ipl_block, ipl_block->hdr.len, 0) != 276 276 ipib_info.checksum) { 277 277 TRACE("Checksum does not match\n"); 278 278 free_page((unsigned long) ipl_block);