From: kernel test robot <lkp@intel.com>
To: "Abd-Alrhman Masalkhi" <abd.masalkhi@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev, 0day robot <lkp@intel.com>
Subject: drivers/md/md-ctl.c:501:27: warning: variable 'mddev' is uninitialized when used here
Date: Wed, 30 Sep 2026 17:25:17 +0200 [thread overview]
Message-ID: <202609301727.iVitGFeh-lkp@intel.com> (raw)
tree: https://github.com/intel-lab-lkp/linux/commits/Abd-Alrhman-Masalkhi/md-make-mddev-lookup-and-ioctl-helpers-non-static/20260928-201223
head: 6b0c58a68cb9e72a888a76dac60d49a88d347118
commit: 6b0c58a68cb9e72a888a76dac60d49a88d347118 md: add a control device for array management
date: 2 days ago
config: arm-randconfig-r2106-20260930 (https://download.01.org/0day-ci/archive/20260930/202609301727.iVitGFeh-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260930/202609301727.iVitGFeh-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/oe-kbuild-all/202609301727.iVitGFeh-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/md/md-ctl.c:501:27: warning: variable 'mddev' is uninitialized when used here [-Wuninitialized]
501 | return get_raid_version(mddev, (struct mdu_version64 __user *)u);
| ^~~~~
drivers/md/md-ctl.c:492:21: note: initialize the variable 'mddev' to silence this warning
492 | struct mddev *mddev;
| ^
| = NULL
1 warning generated.
vim +/mddev +501 drivers/md/md-ctl.c
486
487 static long md_ctl_ioctl(struct file *filp, uint cmd, ulong u)
488 {
489 int err;
490 unsigned int old_cmd;
491 unsigned int noio_flags = 0;
492 struct mddev *mddev;
493 void __user *arg;
494 struct mdu_ioctl md_ctl;
495
496 err = ctl_ioctl_valid(cmd);
497 if (err)
498 return err;
499
500 if (cmd == MD_RAID_VERSION)
> 501 return get_raid_version(mddev, (struct mdu_version64 __user *)u);
502
503 if (copy_from_user(&md_ctl, (void __user *)u, sizeof(md_ctl)))
504 return -EFAULT;
505
506 err = ctl_flags_valid(cmd, md_ctl.flags);
507 if (err)
508 return err;
509
510 mddev = ctl_find_mddev(&md_ctl);
511 if (IS_ERR(mddev))
512 return PTR_ERR(mddev);
513
514 old_cmd = try_convert_ioctl_cmd(cmd, md_ctl.flags);
515 if (old_cmd) {
516 err = md_do_ioctl(mddev->gendisk->part0, 0, old_cmd, md_ctl.arg);
517 goto out;
518 }
519
520 arg = (void __user *)md_ctl.arg;
521 switch (cmd) {
522 case MD_GET_ARRAY_INFO:
523 err = ctl_get_array_info(mddev, arg);
524 goto out;
525
526 case MD_GET_DISK_INFO:
527 err = ctl_get_disk_info(mddev, arg);
528 goto out;
529
530 case MD_GET_BITMAP_FILE:
531 err = ctl_get_bitmap_file(mddev, arg);
532 goto out;
533 };
534
535 if (!md_is_rdwr(mddev))
536 flush_work(&mddev->sync_work);
537
538 err = mddev_suspend_and_lock(mddev);
539 if (err) {
540 pr_debug("md: ioctl lock interrupted, reason %d, cmd %d\n",
541 err, cmd);
542 goto out;
543 }
544 noio_flags = memalloc_noio_save();
545
546 switch (cmd) {
547 case MD_SET_ARRAY_INFO:
548 err = ctl_set_array_info(mddev, arg);
549 break;
550
551 case MD_ADD_NEW_DISK:
552 err = ctl_add_new_disk(mddev, arg);
553 break;
554 }
555
556 if (mddev->hold_active == UNTIL_IOCTL && err != -EINVAL)
557 mddev->hold_active = 0;
558
559 memalloc_noio_restore(noio_flags);
560 mddev_unlock_and_resume(mddev);
561 out:
562 mddev_put(mddev);
563 return err;
564 }
565
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-09-30 15:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202609301727.iVitGFeh-lkp@intel.com \
--to=lkp@intel.com \
--cc=abd.masalkhi@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.