[PATCH] drivers: target: target_core_mod: use div64_u64_rem() instead of operator '%' for u64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In kernel, need use div64_u64_rem() instead of operator '%' for u64, or
can not pass compiling (with allmodconfig under metag):

    MODPOST 2909 modules
  ERROR: "__umoddi3" [drivers/target/target_core_mod.ko] undefined!

Also need u64 type cast for u32 variable multiply u32 variable, or will
cause type overflow issue.


Signed-off-by: Chen Gang <gang.chen.5i5j@xxxxxxxxx>
---
 drivers/target/target_core_alua.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index dc0d399..ff2aadc 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -489,7 +489,8 @@ static inline int core_alua_state_lba_dependent(
 			u64 first_lba = map->lba_map_first_lba;
 
 			if (segment_mult) {
-				start_lba = lba % (segment_size * segment_mult);
+				u64 tmp = (u64)segment_size * segment_mult;
+				div64_u64_rem(lba, tmp, &start_lba);
 				last_lba = first_lba + segment_size - 1;
 				if (start_lba >= first_lba &&
 				    start_lba <= last_lba) {
-- 
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux