login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
August
»
27
Re: [PATCH] kernel: time: use ARRAY_SIZE macro in timecompare.c
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Dmitry Torokhov
Subject:
Re: [PATCH] kernel: time: use ARRAY_SIZE macro in timecompare.c
Date: Friday, August 27, 2010 - 12:37 am
On Tue, Aug 24, 2010 at 12:27:08AM +0100, Nikitas Angelinas wrote:
quoted text
> > > On Sun, 22 Aug 2010, Dmitry Torokhov wrote: > > > On Aug 22, 2010, at 4:43 PM, Nikitas Angelinas > > <nikitasangelinas@googlemail.com> wrote: > > > > >Replace sizeof(buffer)/sizeof(buffer[0]) with ARRAY_SIZE(buffer) in > > >kernel/time/timecompare.c > > > > > >Signed-off-by: Nikitas Angelinas <nikitasangelinas@googlemail.com> > > >--- > > >kernel/time/timecompare.c | 5 +++-- > > >1 files changed, 3 insertions(+), 2 deletions(-) > > > > > >diff --git a/kernel/time/timecompare.c b/kernel/time/timecompare.c > > >index ac38fbb..a9ae369 100644 > > >--- a/kernel/time/timecompare.c > > >+++ b/kernel/time/timecompare.c > > >@@ -21,6 +21,7 @@ > > >#include <linux/module.h> > > >#include <linux/slab.h> > > >#include <linux/math64.h> > > >+#include <linux/kernel.h> > > > > > >/* > > >* fixed point arithmetic scale factor for skew > > >@@ -57,11 +58,11 @@ int timecompare_offset(struct timecompare *sync, > > > int index; > > > int num_samples = sync->num_samples; > > > > > >- if (num_samples > sizeof(buffer)/sizeof(buffer[0])) { > > >+ if (num_samples > ARRAY_SIZE(buffer)) { > > > samples = kmalloc(sizeof(*samples) * num_samples, GFP_ATOMIC); > > > > That should be kcalloc while you are at it. > > > > Thanks. > > > > -- > > Dmitry > > > > > > Thanks for pointing that out; however, the code as is does not do a > memset to 0; is it worth using kcalloc in this case considering it has > to go through an 'unlikely' and a subsequent memset? >
Ah, I see. Ignore me then. Thanks. -- Dmitry --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] kernel: time: use ARRAY_SIZE macro in timecompare.c
, Nikitas Angelinas
, (Sun Aug 22, 4:43 pm)
Re: [PATCH] kernel: time: use ARRAY_SIZE macro in timecomp ...
, Dmitry Torokhov
, (Sun Aug 22, 6:01 pm)
Re: [PATCH] kernel: time: use ARRAY_SIZE macro in timecomp ...
, Nikitas Angelinas
, (Mon Aug 23, 4:27 pm)
Re: [PATCH] kernel: time: use ARRAY_SIZE macro in timecomp ...
, Dmitry Torokhov
, (Fri Aug 27, 12:37 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Greg KH
Og dreams of kernels
Jens Axboe
[PATCH 31/33] Fusion: sg chaining support
Arnd Bergmann
Re: finding your own dead "CONFIG_" variables
Mark Brown
[PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset
Tony Breeds
[LGUEST] Look in object dir for .config
git
:
Brian Downing
Re: Git in a Nutshell guide
John Benes
Re: master has some toys
Matthias Lederhofer
[PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree
Alexander Sulfrian
[RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set
Junio C Hamano
Re: Rss produced by git is not valid xml?
git-commits-head
:
Linux Kernel Mailing List
iSeries: fix section mismatch in iseries_veth
Linux Kernel Mailing List
ixbge: remove TX lock and redo TX accounting.
Linux Kernel Mailing List
ixgbe: fix several counter register errata
Linux Kernel Mailing List
b43: fix build with CONFIG_SSB_PCIHOST=n
Linux Kernel Mailing List
9p: block-based virtio client
linux-netdev
:
Michael Breuer
Re: [PATCH] af_packet: Don't use skb after dev_queue_xmit()
Michael Breuer
Re: [PATCH] af_packet: Don't use skb after dev_queue_xmit()
David Daney
[PATCH 5/7] Staging: Octeon Ethernet: Convert to NAPI.
Wolfgang Grandegger
[PATCH net-next v4 1/3] can: mscan: fix improper return if dlc < 8 in start_xmi...
Amit Kumar Salecha
[PATCHv3 NEXT 2/2] NET: Add Qlogic ethernet driver for CNA devices
openbsd-misc
:
Theo de Raadt
Re: Old IPSEC bug
Tomáš Bodžár
Problem with vpnc connection - check group password !
Insan Praja SW
Mandoc Compiling Error
Carl Roberso
Re: Cannot change MTU of carp interface?
Richard Daemon
Re: booting openbsd on eee without cd-rom
Colocation donated by:
Syndicate