All of lore.kernel.org
 help / color / mirror / Atom feed
* [jfern:linux-debug-webinar 7/7] checkpatch: WARNING: unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html
@ 2023-09-02  7:18 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-09-02  7:18 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "checkpatch"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Joel Fernandes (Google)" <joel@joelfernandes.org>
INFO skip CC for checkpatch warnings

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git linux-debug-webinar
head:   d3807eaa620f57f49898bc00500ac1f69917bf7f
commit: d3807eaa620f57f49898bc00500ac1f69917bf7f [7/7] DEMO: ipi storm kernel module
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
reproduce: (https://download.01.org/0day-ci/archive/20230902/202309021557.swzxpXwW-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202309021557.swzxpXwW-lkp@intel.com/

# many are suggestions rather than must-fix

WARNING: Missing commit description - Add an appropriate one

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#26: 
new file mode 100644

WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#31: drivers/misc/ipist.c:1:
+#include <linux/init.h>

ERROR: open brace '{' following function definitions go on the next line
#45: drivers/misc/ipist.c:15:
+static void ipi_handler(void *info) {

WARNING: please, no spaces at the start of a line
#46: drivers/misc/ipist.c:16:
+     mdelay(2); // Introduce a small delay between IPIs$

ERROR: open brace '{' following function definitions go on the next line
#49: drivers/misc/ipist.c:19:
+static int send_ipis(void *data) {

WARNING: please, no spaces at the start of a line
#50: drivers/misc/ipist.c:20:
+    unsigned long end_time = jiffies + msecs_to_jiffies(50000); // 50 seconds$

WARNING: please, no spaces at the start of a line
#51: drivers/misc/ipist.c:21:
+    int i = 0;$

WARNING: please, no spaces at the start of a line
#53: drivers/misc/ipist.c:23:
+    printk(KERN_ERR "IPI sender thread started on cpu %d\n", smp_processor_id());$

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
#53: drivers/misc/ipist.c:23:
+    printk(KERN_ERR "IPI sender thread started on cpu %d\n", smp_processor_id());

WARNING: please, no spaces at the start of a line
#55: drivers/misc/ipist.c:25:
+    while (time_before(jiffies, end_time)) {$

ERROR: code indent should use tabs where possible
#56: drivers/misc/ipist.c:26:
+        struct __call_single_data *csd =$

WARNING: please, no spaces at the start of a line
#56: drivers/misc/ipist.c:26:
+        struct __call_single_data *csd =$

ERROR: code indent should use tabs where possible
#57: drivers/misc/ipist.c:27:
+            (struct __call_single_data *) kmalloc(sizeof(struct __call_single_data), GFP_KERNEL);$

WARNING: please, no spaces at the start of a line
#57: drivers/misc/ipist.c:27:
+            (struct __call_single_data *) kmalloc(sizeof(struct __call_single_data), GFP_KERNEL);$

WARNING: unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html
#57: drivers/misc/ipist.c:27:
+            (struct __call_single_data *) kmalloc(sizeof(struct __call_single_data), GFP_KERNEL);

ERROR: code indent should use tabs where possible
#58: drivers/misc/ipist.c:28:
+        if (!csd) {$

WARNING: please, no spaces at the start of a line
#58: drivers/misc/ipist.c:28:
+        if (!csd) {$

WARNING: suspect code indent for conditional statements (8, 12)
#58: drivers/misc/ipist.c:28:
+        if (!csd) {
+            printk(KERN_ERR "Failed to allocate memory for csd\n");

ERROR: code indent should use tabs where possible
#59: drivers/misc/ipist.c:29:
+            printk(KERN_ERR "Failed to allocate memory for csd\n");$

WARNING: please, no spaces at the start of a line
#59: drivers/misc/ipist.c:29:
+            printk(KERN_ERR "Failed to allocate memory for csd\n");$

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
#59: drivers/misc/ipist.c:29:
+            printk(KERN_ERR "Failed to allocate memory for csd\n");

ERROR: code indent should use tabs where possible
#60: drivers/misc/ipist.c:30:
+            continue;$

WARNING: please, no spaces at the start of a line
#60: drivers/misc/ipist.c:30:
+            continue;$

ERROR: code indent should use tabs where possible
#61: drivers/misc/ipist.c:31:
+        }$

WARNING: please, no spaces at the start of a line
#61: drivers/misc/ipist.c:31:
+        }$

ERROR: code indent should use tabs where possible
#62: drivers/misc/ipist.c:32:
+        memset(csd, 0, sizeof(struct __call_single_data));$

WARNING: please, no spaces at the start of a line
#62: drivers/misc/ipist.c:32:
+        memset(csd, 0, sizeof(struct __call_single_data));$

ERROR: code indent should use tabs where possible
#63: drivers/misc/ipist.c:33:
+        csd->func = ipi_handler;$

WARNING: please, no spaces at the start of a line
#63: drivers/misc/ipist.c:33:
+        csd->func = ipi_handler;$

ERROR: code indent should use tabs where possible
#64: drivers/misc/ipist.c:34:
+        smp_call_function_single_async(target_cpu, csd);$

WARNING: please, no spaces at the start of a line
#64: drivers/misc/ipist.c:34:
+        smp_call_function_single_async(target_cpu, csd);$

ERROR: code indent should use tabs where possible
#65: drivers/misc/ipist.c:35:
+        if (i++ % 1000 == 0) {$

WARNING: please, no spaces at the start of a line
#65: drivers/misc/ipist.c:35:
+        if (i++ % 1000 == 0) {$

WARNING: suspect code indent for conditional statements (8, 12)
#65: drivers/misc/ipist.c:35:
+        if (i++ % 1000 == 0) {
+            msleep(5);

WARNING: braces {} are not necessary for single statement blocks
#65: drivers/misc/ipist.c:35:
+        if (i++ % 1000 == 0) {
+            msleep(5);
+        }

ERROR: code indent should use tabs where possible
#66: drivers/misc/ipist.c:36:
+            msleep(5);$

WARNING: please, no spaces at the start of a line
#66: drivers/misc/ipist.c:36:
+            msleep(5);$

WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst
#66: drivers/misc/ipist.c:36:
+            msleep(5);

ERROR: code indent should use tabs where possible
#67: drivers/misc/ipist.c:37:
+        }$

WARNING: please, no spaces at the start of a line
#67: drivers/misc/ipist.c:37:
+        }$

WARNING: please, no spaces at the start of a line
#68: drivers/misc/ipist.c:38:
+    }$

WARNING: please, no spaces at the start of a line
#70: drivers/misc/ipist.c:40:
+    return 0;$

ERROR: open brace '{' following function definitions go on the next line
#73: drivers/misc/ipist.c:43:
+static int __init my_module_init(void) {

WARNING: please, no spaces at the start of a line
#74: drivers/misc/ipist.c:44:
+    printk(KERN_INFO "Loading module to continuously send IPIs...\n");$

WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
#74: drivers/misc/ipist.c:44:
+    printk(KERN_INFO "Loading module to continuously send IPIs...\n");

WARNING: please, no spaces at the start of a line
#76: drivers/misc/ipist.c:46:
+    target_cpu = (smp_processor_id() + 1) % nr_cpu_ids; // Choose the next CPU as target$

WARNING: please, no spaces at the start of a line
#78: drivers/misc/ipist.c:48:
+    printk(KERN_ERR "Target CPU: %d\n", target_cpu);$

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
#78: drivers/misc/ipist.c:48:
+    printk(KERN_ERR "Target CPU: %d\n", target_cpu);

WARNING: please, no spaces at the start of a line
#82: drivers/misc/ipist.c:52:
+    ipi_thread = kthread_create_on_cpu(send_ipis, NULL, smp_processor_id(), "ipi_sender_thread");$

WARNING: please, no spaces at the start of a line
#83: drivers/misc/ipist.c:53:
+    if (IS_ERR(ipi_thread)) {$

ERROR: code indent should use tabs where possible
#84: drivers/misc/ipist.c:54:
+        printk(KERN_ERR "Failed to create IPI sender thread\n");$

WARNING: please, no spaces at the start of a line
#84: drivers/misc/ipist.c:54:
+        printk(KERN_ERR "Failed to create IPI sender thread\n");$

WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
#84: drivers/misc/ipist.c:54:
+        printk(KERN_ERR "Failed to create IPI sender thread\n");

ERROR: code indent should use tabs where possible
#85: drivers/misc/ipist.c:55:
+        return PTR_ERR(ipi_thread);$

WARNING: please, no spaces at the start of a line
#85: drivers/misc/ipist.c:55:
+        return PTR_ERR(ipi_thread);$

WARNING: please, no spaces at the start of a line
#86: drivers/misc/ipist.c:56:
+    }$

ERROR: trailing whitespace
#87: drivers/misc/ipist.c:57:
+    $

WARNING: please, no spaces at the start of a line
#87: drivers/misc/ipist.c:57:
+    $

WARNING: please, no spaces at the start of a line
#88: drivers/misc/ipist.c:58:
+    wake_up_process(ipi_thread);$

WARNING: please, no spaces at the start of a line
#89: drivers/misc/ipist.c:59:
+    return 0;$

ERROR: open brace '{' following function definitions go on the next line
#92: drivers/misc/ipist.c:62:
+static void __exit my_module_exit(void) {

WARNING: please, no spaces at the start of a line
#93: drivers/misc/ipist.c:63:
+    printk(KERN_INFO "Unloading module...\n");$

WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
#93: drivers/misc/ipist.c:63:
+    printk(KERN_INFO "Unloading module...\n");

WARNING: please, no spaces at the start of a line
#94: drivers/misc/ipist.c:64:
+    kthread_stop(ipi_thread);$

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-02  7:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-02  7:18 [jfern:linux-debug-webinar 7/7] checkpatch: WARNING: unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.