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

s390/stp: clock_delta should be signed

clock_delta is declared as unsigned long in various places. However,
the clock sync delta can be negative. This would add a huge positive
offset in clock_sync_global where clock_delta is added to clk.eitod
which is a 72 bit integer. Declare it as signed long to fix this.

Cc: stable@vger.kernel.org
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Sven Schnelle and committed by
Heiko Carstens
5ace65eb 03780c83

+7 -7
+1 -1
arch/s390/include/asm/cio.h
··· 369 369 struct gen_pool *cio_gp_dma_create(struct device *dma_dev, int nr_pages); 370 370 371 371 /* Function from drivers/s390/cio/chsc.c */ 372 - int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta); 372 + int chsc_sstpc(void *page, unsigned int op, u16 ctrl, long *clock_delta); 373 373 int chsc_sstpi(void *page, void *result, size_t size); 374 374 int chsc_stzi(void *page, void *result, size_t size); 375 375 int chsc_sgib(u32 origin);
+4 -4
arch/s390/kernel/time.c
··· 364 364 * Apply clock delta to the global data structures. 365 365 * This is called once on the CPU that performed the clock sync. 366 366 */ 367 - static void clock_sync_global(unsigned long delta) 367 + static void clock_sync_global(long delta) 368 368 { 369 369 unsigned long now, adj; 370 370 struct ptff_qto qto; ··· 400 400 * Apply clock delta to the per-CPU data structures of this CPU. 401 401 * This is called for each online CPU after the call to clock_sync_global. 402 402 */ 403 - static void clock_sync_local(unsigned long delta) 403 + static void clock_sync_local(long delta) 404 404 { 405 405 /* Add the delta to the clock comparator. */ 406 406 if (S390_lowcore.clock_comparator != clock_comparator_max) { ··· 424 424 struct clock_sync_data { 425 425 atomic_t cpus; 426 426 int in_sync; 427 - unsigned long clock_delta; 427 + long clock_delta; 428 428 }; 429 429 430 430 /* ··· 544 544 static int stp_sync_clock(void *data) 545 545 { 546 546 struct clock_sync_data *sync = data; 547 - u64 clock_delta, flags; 547 + long clock_delta, flags; 548 548 static int first; 549 549 int rc; 550 550
+2 -2
drivers/s390/cio/chsc.c
··· 1255 1255 EXPORT_SYMBOL_GPL(css_general_characteristics); 1256 1256 EXPORT_SYMBOL_GPL(css_chsc_characteristics); 1257 1257 1258 - int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta) 1258 + int chsc_sstpc(void *page, unsigned int op, u16 ctrl, long *clock_delta) 1259 1259 { 1260 1260 struct { 1261 1261 struct chsc_header request; ··· 1266 1266 unsigned int rsvd2[5]; 1267 1267 struct chsc_header response; 1268 1268 unsigned int rsvd3[3]; 1269 - u64 clock_delta; 1269 + s64 clock_delta; 1270 1270 unsigned int rsvd4[2]; 1271 1271 } *rr; 1272 1272 int rc;