linux
Argument type incompatible with `printk' format string AMIGA's ramdisk support contains a type error (reported as a warning by gcc) when LBDAF is enabled. The result of `blk_rq_pos(req)' has type `sector_t' and is printed as an unsigned long value. Yet, when LBDAF is enabled, type `sector_t' is defined as unsigned long long. There is no safe cast from unsigned long long to unsigned long. The fix consists in printing the value as unsigned long long instead, without losing precision when LBDAF is enabled.
Bug fixed by commit e1fbd9210d5
Type | IncompatibleType |
Config | "AMIGA_Z2RAM && LBDAF" (2nd degree) |
Fix-in | code |
Location | drivers/ |
#include <stdio.h> #ifdef CONFIG_LBDAF typedef unsigned long long sector_t; #else typedef unsigned long sector_t; #endif sector_t blk_rq_pos() { return 0; } #ifdef CONFIG_AMIGA_Z2RAM static void do_z2_request() { printf("bad access: block=%lu\n", blk_rq_pos()); // ERROR } #endif int main() { #ifdef CONFIG_AMIGA_Z2RAM do_z2_request(); #endif return 0; }
#include <stdio.h> #ifdef CONFIG_LBDAF typedef unsigned long long sector_t; #else typedef unsigned long sector_t; #endif int main() { #ifdef CONFIG_AMIGA_Z2RAM // do_z2_request(); printf("bad access: block=%lu\n", (sector_t) 0); // ERROR #endif return 0; }
. drivers/block/z2ram.c:80: printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n",