printk/ringbuffer: Extend the sequence number properly on 32bit.

The sequence number on 32bit platform is extendend to a full 64bit
variable from a 32bit value and a 64bit previous record.
The formala as-is is okay but it relies on the right part to be negative
which is not the case if the result is a unsigned variable.

Cast the result to a signed variable.

Reported-by: Francesco Dolcini <francesco@dolcini.it>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202311171611.78d41dbe-oliver.sang@intel.com
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202311161555.3ee16fc9-oliver.sang@intel.com
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
This commit is contained in:
Sebastian Andrzej Siewior
2023-11-20 15:06:57 +01:00
parent 5cc961eb9e
commit ed641c243b
+1 -1
View File
@@ -1477,7 +1477,7 @@ static inline u64 __ulseq_to_u64seq(u32 ulseq)
* sequence. It needs to be expanded to 64bit. Get the first sequence
* number from the ringbuffer and fold it.
*/
seq = rb_first_seq - ((u32)rb_first_seq - ulseq);
seq = rb_first_seq - ((s32)((u32)rb_first_seq - ulseq));
return seq;
}