Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1640695

[PATCH 3/3] coresight: etb10: Improve a size determination in etb_alloc_buffer()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 3/3] coresight: etb10: Improve a size determination in etb_alloc_buffer()
Date 2017-05-12 21:00 +0200
Message-ID <tGnXb-lv-13@gated-at.bofh.it> (permalink)
References <tGnXb-lv-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 12 May 2017 20:36:03 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hwtracing/coresight/coresight-etb10.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
index d5b96423e1a5..7096c4562e15 100644
--- a/drivers/hwtracing/coresight/coresight-etb10.c
+++ b/drivers/hwtracing/coresight/coresight-etb10.c
@@ -278,8 +278,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,
 	if (cpu == -1)
 		cpu = smp_processor_id();
 	node = cpu_to_node(cpu);
-
-	buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node);
+	buf = kzalloc_node(sizeof(*buf), GFP_KERNEL, node);
 	if (!buf)
 		return NULL;
 
-- 
2.12.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] CoreSight-ETB10: Adjustments for three function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-12 21:00 +0200
  [PATCH 2/3] coresight: etb10: Fix a typo in a comment line SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-12 21:00 +0200
    Re: [PATCH 2/3] coresight: etb10: Fix a typo in a comment line Mathieu Poirier <mathieu.poirier@linaro.org> - 2017-05-15 19:50 +0200
  [PATCH 3/3] coresight: etb10: Improve a size determination in  etb_alloc_buffer() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-12 21:00 +0200
    Re: [PATCH 3/3] coresight: etb10: Improve a size determination in etb_alloc_buffer() Mathieu Poirier <mathieu.poirier@linaro.org> - 2017-05-15 19:50 +0200
      Re: [PATCH 3/3] coresight: etb10: Improve a size determination in  etb_alloc_buffer() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-15 21:40 +0200

csiph-web