Thread (2 messages) flat view 2 messages, 2 authors, 2021-08-05

Re: [PATCH] Documentation: Checkpatch.rst: Doc added UNNECESSARY_CAST

From: Dwaipayan Ray <dwaipayanray1@gmail.com>
Date: 2021-08-05 13:40:15

On Thu, Aug 5, 2021 at 4:21 PM Vinesh Raut [off-list ref] wrote:
Documentation was missing for UNNECESSARY_CAST Warning.
Added it to checkpatch.rst with refers from https://lore.kernel.org
Also, pointers been mentioned in Documentation
This message isn't particularly useful.
A simple:

Add verbose description for UNNECESSARY_CAST message type.

would have worked.
quoted hunk ↗ jump to hunk
Suggested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Vinesh Raut <redacted>
---
 Documentation/dev-tools/checkpatch.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst
index f0956e9ea2d8..72c2f32b1515 100644
--- a/Documentation/dev-tools/checkpatch.rst
+++ b/Documentation/dev-tools/checkpatch.rst
@@ -268,6 +268,16 @@ Allocation style

     See: https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html

+   **UNNECESSARY_CASTS**
+      Any alloc functions should not be cast. Because they usually returns the
+      void pointer, which compiler then implicitly picks the type of pointer at
s/returns/return

The sentence sounds weird. Maybe refactor it a bit?
+      run time. Hence, casting is not prefer on any alloc functions. cast may
+      hide bugs if any exist, as compiler supresses the warnings after casting.
Here too. Simpler sentences are preferred.
+
+      See:
+      http://c-faq.com/malloc/mallocnocast.html
Let's not use this link here. External websites are vulnerable to change.
However lore.kernel.org links are okay.
+      https://lore.kernel.org/lkml/20070808024321.GA6316@redhat.com/ (local)
+      https://lore.kernel.org/lkml/a5e60a2b93e10baf84af063f6c8e56402273105d.camel@perches.com/ (local)
You can enumerate these. See the format followed by other verbose
descriptions.

Dwaipayan.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help