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

time: Use ARRAY_SIZE macro in timecompare.c

Replace sizeof(buffer)/sizeof(buffer[0]) with ARRAY_SIZE(buffer) in
kernel/time/timecompare.c

Signed-off-by: Nikitas Angelinas <nikitasangelinas@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Nikitas Angelinas and committed by
Thomas Gleixner
2bf1c05e aaabe31c

+3 -2
+3 -2
kernel/time/timecompare.c
··· 21 21 #include <linux/module.h> 22 22 #include <linux/slab.h> 23 23 #include <linux/math64.h> 24 + #include <linux/kernel.h> 24 25 25 26 /* 26 27 * fixed point arithmetic scale factor for skew ··· 58 57 int index; 59 58 int num_samples = sync->num_samples; 60 59 61 - if (num_samples > sizeof(buffer)/sizeof(buffer[0])) { 60 + if (num_samples > ARRAY_SIZE(buffer)) { 62 61 samples = kmalloc(sizeof(*samples) * num_samples, GFP_ATOMIC); 63 62 if (!samples) { 64 63 samples = buffer; 65 - num_samples = sizeof(buffer)/sizeof(buffer[0]); 64 + num_samples = ARRAY_SIZE(buffer); 66 65 } 67 66 } else { 68 67 samples = buffer;