Skip to contentSkip to conversation

drm/i915: fix application of sizeof to pointer

PATCH In review [email protected] 2 participants 2 messages Jul 20, 2023 – Jul 31, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 drm/i915: fix application of sizeof to pointer

The coccinelle check report:
./drivers/scsi/csiostor/csio_mb.c:1554:46-52: ERROR: application of sizeof to pointer

---
 drivers/gpu/drm/i915/i915_syncmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_syncmap.c +1 -1
index 60404dbb2e9f..4eeaf12be72d 100644
@@ -282,7 +282,7 @@ static noinline int __sync_set(struct i915_syncmap **root, u64 id, u32 seqno)
 			unsigned int above;
 
 			/* Insert a join above the current layer */
-			next = kzalloc(sizeof(*next) + KSYNCMAP * sizeof(next),
+			next = kzalloc(sizeof(*next) + KSYNCMAP * sizeof(*next),
 				       GFP_KERNEL);
 			if (unlikely(!next))
 				return -ENOMEM;
maintainer
#2 lore raw
Quoted 3 lines · On Thu, 20 Jul 2023, [email protected] wrote:

The coccinelle check report:
./drivers/scsi/csiostor/csio_mb.c:1554:46-52: ERROR: application of sizeof to pointer

Please don't just assume coccinelle is right, and send "fixes" based on the cocci reports alone. You need to read and understand the code you're changing.

BR,
Jani.

Quoted 21 lines
---
  drivers/gpu/drm/i915/i915_syncmap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_syncmap.c +1 -1
index 60404dbb2e9f..4eeaf12be72d 100644
@@ -282,7 +282,7 @@ static noinline int __sync_set(struct i915_syncmap 
 **root, u64 id, u32 seqno)
  			unsigned int above;
 
  			/* Insert a join above the current layer */
-			next = kzalloc(sizeof(*next) + KSYNCMAP * sizeof(next),
+			next = kzalloc(sizeof(*next) + KSYNCMAP * sizeof(*next),
  				       GFP_KERNEL);
  			if (unlikely(!next))

return -ENOMEM;

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center