drivers/firmware/microchip/mpfs-auto-update.c:387:72-78: ERROR: application of sizeof to pointer

From: kernel test robot
Date: Sun Mar 03 2024 - 16:10:13 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 58c806d867bf265c6fd16fc3bc62e2d3c156b5c9
commit: ec5b0f1193ad461e53d083edad8fab0298fe68e3 firmware: microchip: add PolarFire SoC Auto Update support
date: 3 months ago
config: microblaze-randconfig-r061-20240303 (https://download.01.org/0day-ci/archive/20240304/202403040516.CYxoWTXw-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-gcc (GCC) 13.2.0

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403040516.CYxoWTXw-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/firmware/microchip/mpfs-auto-update.c:387:72-78: ERROR: application of sizeof to pointer
drivers/firmware/microchip/mpfs-auto-update.c:170:72-78: ERROR: application of sizeof to pointer

vim +387 drivers/firmware/microchip/mpfs-auto-update.c

379
380 static int mpfs_auto_update_available(struct mpfs_auto_update_priv *priv)
381 {
382 struct mpfs_mss_response *response;
383 struct mpfs_mss_msg *message;
384 u32 *response_msg;
385 int ret;
386
> 387 response_msg = devm_kzalloc(priv->dev, AUTO_UPDATE_FEATURE_RESP_SIZE * sizeof(response_msg),
388 GFP_KERNEL);
389 if (!response_msg)
390 return -ENOMEM;
391
392 response = devm_kzalloc(priv->dev, sizeof(struct mpfs_mss_response), GFP_KERNEL);
393 if (!response)
394 return -ENOMEM;
395
396 message = devm_kzalloc(priv->dev, sizeof(struct mpfs_mss_msg), GFP_KERNEL);
397 if (!message)
398 return -ENOMEM;
399
400 /*
401 * To verify that Auto Update is possible, the "Query Security Service
402 * Request" is performed.
403 * This service has no command data & does not overload mbox_offset.
404 */
405 response->resp_msg = response_msg;
406 response->resp_size = AUTO_UPDATE_FEATURE_RESP_SIZE;
407 message->cmd_opcode = AUTO_UPDATE_FEATURE_CMD_OPCODE;
408 message->cmd_data_size = AUTO_UPDATE_FEATURE_CMD_DATA_SIZE;
409 message->response = response;
410 message->cmd_data = AUTO_UPDATE_FEATURE_CMD_DATA;
411 message->mbox_offset = AUTO_UPDATE_DEFAULT_MBOX_OFFSET;
412 message->resp_offset = AUTO_UPDATE_DEFAULT_RESP_OFFSET;
413
414 ret = mpfs_blocking_transaction(priv->sys_controller, message);
415 if (ret)
416 return ret;
417
418 /*
419 * Currently, the system controller's firmware does not generate any
420 * interrupts for failed services, so mpfs_blocking_transaction() should
421 * time out & therefore return an error.
422 * Hitting this check is highly unlikely at present, but if the system
423 * controller's behaviour changes so that it does generate interrupts
424 * for failed services, it will be required.
425 */
426 if (response->resp_status)
427 return -EIO;
428
429 /*
430 * Bit 5 of byte 1 is "UL_Auto Update" & if it is set, Auto Update is
431 * not possible.
432 */
433 if (response_msg[1] & AUTO_UPDATE_FEATURE_ENABLED)
434 return -EPERM;
435
436 return 0;
437 }
438

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