linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Francesco Valla <francesco@valla.it>, linux-embedded@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH 1/1] drivers: misc: add driver for bootstage stash
Date: Sat, 24 May 2025 15:18:00 +0800	[thread overview]
Message-ID: <202505241547.wVTtLz71-lkp@intel.com> (raw)
In-Reply-To: <20250522224223.358881-3-francesco@valla.it>

Hi Francesco,

kernel test robot noticed the following build warnings:

[auto build test WARNING on char-misc/char-misc-linus]
[also build test WARNING on robh/for-next linus/master v6.15-rc7]
[cannot apply to char-misc/char-misc-testing char-misc/char-misc-next next-20250523]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Francesco-Valla/drivers-misc-add-driver-for-bootstage-stash/20250523-122757
base:   char-misc/char-misc-linus
patch link:    https://lore.kernel.org/r/20250522224223.358881-3-francesco%40valla.it
patch subject: [PATCH 1/1] drivers: misc: add driver for bootstage stash
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20250524/202505241547.wVTtLz71-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250524/202505241547.wVTtLz71-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/202505241547.wVTtLz71-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/misc/bootstage.c:164:24: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]
     163 |                 dev_err(dev, "invalid declared stash size %u (expected: <= %llu)\n",
         |                                                                            ~~~~
         |                                                                            %u
     164 |                         drvdata->hdr->size, size);
         |                                             ^~~~
   include/linux/dev_printk.h:154:65: note: expanded from macro 'dev_err'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ~~~    ^~~~~~~~~~~
   drivers/misc/bootstage.c:168:4: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]
     167 |                 dev_err(dev, "invalid calculated stash size %llu (expected: <= %llu)\n",
         |                                                             ~~~~
         |                                                             %u
     168 |                         calc_size, size);
         |                         ^~~~~~~~~
   include/linux/dev_printk.h:154:65: note: expanded from macro 'dev_err'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ~~~    ^~~~~~~~~~~
   drivers/misc/bootstage.c:168:15: warning: format specifies type 'unsigned long long' but the argument has type 'resource_size_t' (aka 'unsigned int') [-Wformat]
     167 |                 dev_err(dev, "invalid calculated stash size %llu (expected: <= %llu)\n",
         |                                                                                ~~~~
         |                                                                                %u
     168 |                         calc_size, size);
         |                                    ^~~~
   include/linux/dev_printk.h:154:65: note: expanded from macro 'dev_err'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                                ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ~~~    ^~~~~~~~~~~
   3 warnings generated.


vim +164 drivers/misc/bootstage.c

   143	
   144	static int bootstage_parse(struct device *dev, struct bootstage_drvdata *drvdata,
   145				   resource_size_t size)
   146	{
   147		const char *str_ptr = (const char *)(drvdata->records + drvdata->hdr->count);
   148		const resource_size_t calc_size = (resource_size_t)((void *)str_ptr - (void *)drvdata->hdr);
   149		struct bootstage_record *rec;
   150		u32 r;
   151	
   152		// Sanity checks on bootstage header
   153		if (drvdata->hdr->magic != BOOTSTAGE_MAGIC) {
   154			dev_err(dev, "wrong bootstage magic number %08Xh\n", drvdata->hdr->magic);
   155			return -EINVAL;
   156		} else if (drvdata->hdr->version > BOOTSTAGE_MAX_VERSION) {
   157			dev_err(dev, "bootstage version %u not supported\n", drvdata->hdr->version);
   158			return -EOPNOTSUPP;
   159		} else if (drvdata->hdr->size == 0) {
   160			dev_err(dev, "invalid bootstage stash (declared size is zero)\n");
   161			return -EINVAL;
   162		} else if (drvdata->hdr->size > size) {
   163			dev_err(dev, "invalid declared stash size %u (expected: <= %llu)\n",
 > 164				drvdata->hdr->size, size);
   165			return -EINVAL;
   166		} else if (calc_size > size) {
   167			dev_err(dev, "invalid calculated stash size %llu (expected: <= %llu)\n",
   168				calc_size, size);
   169			return -EINVAL;
   170		} else if (drvdata->hdr->count == 0) {
   171			dev_info(dev, "bootstage stash has no records\n");
   172			return 0;
   173		}
   174	
   175		// Set start time to invalid
   176		drvdata->start_time_us = 0xFFFFFFFF;
   177	
   178		// Associate names to records, which are placed at the end of the record area
   179		for (r = 0, rec = drvdata->records; r < drvdata->hdr->count; r++, rec++) {
   180			// Save minimum time, will be used as bootloader enter time
   181			if (rec->start_us < drvdata->start_time_us)
   182				drvdata->start_time_us = rec->time_us;
   183	
   184			// Save maximum time, will be used as bootloader exit time
   185			if (rec->time_us > drvdata->end_time_us)
   186				drvdata->end_time_us = rec->time_us;
   187	
   188			if (str_ptr > ((const char *)drvdata->hdr + size)) {
   189				dev_err(dev, "name for record %u is corrupted\n", r);
   190				return -ENODATA;
   191			}
   192	
   193			rec->name = str_ptr;
   194			str_ptr += strlen(rec->name) + 1;
   195		}
   196	
   197		return 0;
   198	}
   199	

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

  parent reply	other threads:[~2025-05-24  7:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 22:42 [RFC PATCH 0/1] Add driver for bootstage stash Francesco Valla
2025-05-22 22:42 ` [PATCH 1/1] drivers: misc: add " Francesco Valla
2025-05-23  6:29   ` Krzysztof Kozlowski
2025-05-23 19:34     ` Rob Landley
2025-05-24  6:16       ` Krzysztof Kozlowski
2025-05-23 19:43     ` Francesco Valla
2025-05-24  6:15       ` Krzysztof Kozlowski
2025-05-23 23:43   ` Bird, Tim
2025-05-24  7:18   ` kernel test robot [this message]
2025-05-23  7:04 ` [RFC PATCH 0/1] Add " Geert Uytterhoeven
2025-05-23 20:06   ` Francesco Valla
     [not found] ` <PA4PR08MB604681FF6392B25A19926A11ED98A@PA4PR08MB6046.eurprd08.prod.outlook.com>
2025-05-23  7:34   ` Federico Giovanardi
2025-05-23 19:43     ` Rob Landley
2025-05-23 20:11     ` Francesco Valla
2025-05-24  0:07     ` Bird, Tim
2025-05-24  0:28       ` Bird, Tim

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=202505241547.wVTtLz71-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=francesco@valla.it \
    --cc=linux-embedded@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --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;
as well as URLs for NNTP newsgroup(s).