From: kernel test robot <lkp@intel.com>
To: Dragan Cvetic <dragan.cvetic@xilinx.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Derek Kiernan <derek.kiernan@xilinx.com>
Subject: drivers/misc/xilinx_sdfec.c:92:57: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6
Date: Tue, 26 Dec 2023 13:56:23 +0800 [thread overview]
Message-ID: <202312261345.5icSobz6-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fbafc3e621c3f4ded43720fdb1d6ce1728ec664e
commit: 76d83e1c32334a793e50de6f955c2eefcc60bb8e misc: xilinx-sdfec: add core driver
date: 4 years, 6 months ago
config: sparc64-randconfig-r025-20230806 (https://download.01.org/0day-ci/archive/20231226/202312261345.5icSobz6-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20231226/202312261345.5icSobz6-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/202312261345.5icSobz6-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/misc/xilinx_sdfec.c: In function 'xsdfec_probe':
>> drivers/misc/xilinx_sdfec.c:92:57: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
92 | snprintf(xsdfec->dev_name, DEV_NAME_LEN, "xsdfec%d", xsdfec->dev_id);
| ^~
drivers/misc/xilinx_sdfec.c:92:50: note: directive argument in the range [0, 2147483647]
92 | snprintf(xsdfec->dev_name, DEV_NAME_LEN, "xsdfec%d", xsdfec->dev_id);
| ^~~~~~~~~~
drivers/misc/xilinx_sdfec.c:92:9: note: 'snprintf' output between 8 and 17 bytes into a destination of size 12
92 | snprintf(xsdfec->dev_name, DEV_NAME_LEN, "xsdfec%d", xsdfec->dev_id);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for COMPAT_BINFMT_ELF
Depends on [n]: COMPAT [=y] && BINFMT_ELF [=n]
Selected by [y]:
- COMPAT [=y] && SPARC64 [=y]
vim +92 drivers/misc/xilinx_sdfec.c
59
60 static int xsdfec_probe(struct platform_device *pdev)
61 {
62 struct xsdfec_dev *xsdfec;
63 struct device *dev;
64 struct resource *res;
65 int err;
66
67 xsdfec = devm_kzalloc(&pdev->dev, sizeof(*xsdfec), GFP_KERNEL);
68 if (!xsdfec)
69 return -ENOMEM;
70
71 xsdfec->dev = &pdev->dev;
72 spin_lock_init(&xsdfec->error_data_lock);
73
74 dev = xsdfec->dev;
75 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
76 xsdfec->regs = devm_ioremap_resource(dev, res);
77 if (IS_ERR(xsdfec->regs)) {
78 err = PTR_ERR(xsdfec->regs);
79 return err;
80 }
81
82 /* Save driver private data */
83 platform_set_drvdata(pdev, xsdfec);
84
85 mutex_lock(&dev_idr_lock);
86 err = idr_alloc(&dev_idr, xsdfec->dev_name, 0, 0, GFP_KERNEL);
87 mutex_unlock(&dev_idr_lock);
88 if (err < 0)
89 goto err_xsddev_idr;
90 xsdfec->dev_id = err;
91
> 92 snprintf(xsdfec->dev_name, DEV_NAME_LEN, "xsdfec%d", xsdfec->dev_id);
93 xsdfec->miscdev.minor = MISC_DYNAMIC_MINOR;
94 xsdfec->miscdev.name = xsdfec->dev_name;
95 xsdfec->miscdev.fops = &xsdfec_fops;
96 xsdfec->miscdev.parent = dev;
97 err = misc_register(&xsdfec->miscdev);
98 if (err) {
99 dev_err(dev, "error:%d. Unable to register device", err);
100 return err;
101 }
102 return 0;
103
104 err_xsddev_idr:
105 xsdfec_idr_remove(xsdfec);
106
107 return err;
108 }
109
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-12-26 5:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-26 5:56 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-12-22 11:08 drivers/misc/xilinx_sdfec.c:92:57: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6 kernel test robot
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=202312261345.5icSobz6-lkp@intel.com \
--to=lkp@intel.com \
--cc=derek.kiernan@xilinx.com \
--cc=dragan.cvetic@xilinx.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox