All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 4326/8804] block/partitions/cmdline.c:100:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
@ 2021-08-18 13:02 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-18 13:02 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 5963 bytes --]

CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Christoph Hellwig <hch@lst.de>
CC: Jens Axboe <axboe@kernel.dk>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   f26c3abc432a2026ba9ee7767061a1f88aead6ec
commit: 2164877c7f373e14e55fca20b7c4a9c436fe4462 [4326/8804] block: remove cmdline-parser.c
:::::: branch date: 5 hours ago
:::::: commit date: 2 weeks ago
compiler: xtensa-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> block/partitions/cmdline.c:100:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
     partdef += 2;
     ^

vim +100 block/partitions/cmdline.c

2164877c7f373e Christoph Hellwig 2021-07-28   41  
2164877c7f373e Christoph Hellwig 2021-07-28   42  static int parse_subpart(struct cmdline_subpart **subpart, char *partdef)
2164877c7f373e Christoph Hellwig 2021-07-28   43  {
2164877c7f373e Christoph Hellwig 2021-07-28   44  	int ret = 0;
2164877c7f373e Christoph Hellwig 2021-07-28   45  	struct cmdline_subpart *new_subpart;
2164877c7f373e Christoph Hellwig 2021-07-28   46  
2164877c7f373e Christoph Hellwig 2021-07-28   47  	*subpart = NULL;
2164877c7f373e Christoph Hellwig 2021-07-28   48  
2164877c7f373e Christoph Hellwig 2021-07-28   49  	new_subpart = kzalloc(sizeof(struct cmdline_subpart), GFP_KERNEL);
2164877c7f373e Christoph Hellwig 2021-07-28   50  	if (!new_subpart)
2164877c7f373e Christoph Hellwig 2021-07-28   51  		return -ENOMEM;
2164877c7f373e Christoph Hellwig 2021-07-28   52  
2164877c7f373e Christoph Hellwig 2021-07-28   53  	if (*partdef == '-') {
2164877c7f373e Christoph Hellwig 2021-07-28   54  		new_subpart->size = (sector_t)(~0ULL);
2164877c7f373e Christoph Hellwig 2021-07-28   55  		partdef++;
2164877c7f373e Christoph Hellwig 2021-07-28   56  	} else {
2164877c7f373e Christoph Hellwig 2021-07-28   57  		new_subpart->size = (sector_t)memparse(partdef, &partdef);
2164877c7f373e Christoph Hellwig 2021-07-28   58  		if (new_subpart->size < (sector_t)PAGE_SIZE) {
2164877c7f373e Christoph Hellwig 2021-07-28   59  			pr_warn("cmdline partition size is invalid.");
2164877c7f373e Christoph Hellwig 2021-07-28   60  			ret = -EINVAL;
2164877c7f373e Christoph Hellwig 2021-07-28   61  			goto fail;
2164877c7f373e Christoph Hellwig 2021-07-28   62  		}
2164877c7f373e Christoph Hellwig 2021-07-28   63  	}
2164877c7f373e Christoph Hellwig 2021-07-28   64  
2164877c7f373e Christoph Hellwig 2021-07-28   65  	if (*partdef == '@') {
2164877c7f373e Christoph Hellwig 2021-07-28   66  		partdef++;
2164877c7f373e Christoph Hellwig 2021-07-28   67  		new_subpart->from = (sector_t)memparse(partdef, &partdef);
2164877c7f373e Christoph Hellwig 2021-07-28   68  	} else {
2164877c7f373e Christoph Hellwig 2021-07-28   69  		new_subpart->from = (sector_t)(~0ULL);
2164877c7f373e Christoph Hellwig 2021-07-28   70  	}
2164877c7f373e Christoph Hellwig 2021-07-28   71  
2164877c7f373e Christoph Hellwig 2021-07-28   72  	if (*partdef == '(') {
2164877c7f373e Christoph Hellwig 2021-07-28   73  		int length;
2164877c7f373e Christoph Hellwig 2021-07-28   74  		char *next = strchr(++partdef, ')');
2164877c7f373e Christoph Hellwig 2021-07-28   75  
2164877c7f373e Christoph Hellwig 2021-07-28   76  		if (!next) {
2164877c7f373e Christoph Hellwig 2021-07-28   77  			pr_warn("cmdline partition format is invalid.");
2164877c7f373e Christoph Hellwig 2021-07-28   78  			ret = -EINVAL;
2164877c7f373e Christoph Hellwig 2021-07-28   79  			goto fail;
2164877c7f373e Christoph Hellwig 2021-07-28   80  		}
2164877c7f373e Christoph Hellwig 2021-07-28   81  
2164877c7f373e Christoph Hellwig 2021-07-28   82  		length = min_t(int, next - partdef,
2164877c7f373e Christoph Hellwig 2021-07-28   83  			       sizeof(new_subpart->name) - 1);
2164877c7f373e Christoph Hellwig 2021-07-28   84  		strncpy(new_subpart->name, partdef, length);
2164877c7f373e Christoph Hellwig 2021-07-28   85  		new_subpart->name[length] = '\0';
2164877c7f373e Christoph Hellwig 2021-07-28   86  
2164877c7f373e Christoph Hellwig 2021-07-28   87  		partdef = ++next;
2164877c7f373e Christoph Hellwig 2021-07-28   88  	} else
2164877c7f373e Christoph Hellwig 2021-07-28   89  		new_subpart->name[0] = '\0';
2164877c7f373e Christoph Hellwig 2021-07-28   90  
2164877c7f373e Christoph Hellwig 2021-07-28   91  	new_subpart->flags = 0;
2164877c7f373e Christoph Hellwig 2021-07-28   92  
2164877c7f373e Christoph Hellwig 2021-07-28   93  	if (!strncmp(partdef, "ro", 2)) {
2164877c7f373e Christoph Hellwig 2021-07-28   94  		new_subpart->flags |= PF_RDONLY;
2164877c7f373e Christoph Hellwig 2021-07-28   95  		partdef += 2;
2164877c7f373e Christoph Hellwig 2021-07-28   96  	}
2164877c7f373e Christoph Hellwig 2021-07-28   97  
2164877c7f373e Christoph Hellwig 2021-07-28   98  	if (!strncmp(partdef, "lk", 2)) {
2164877c7f373e Christoph Hellwig 2021-07-28   99  		new_subpart->flags |= PF_POWERUP_LOCK;
2164877c7f373e Christoph Hellwig 2021-07-28 @100  		partdef += 2;
2164877c7f373e Christoph Hellwig 2021-07-28  101  	}
2164877c7f373e Christoph Hellwig 2021-07-28  102  
2164877c7f373e Christoph Hellwig 2021-07-28  103  	*subpart = new_subpart;
2164877c7f373e Christoph Hellwig 2021-07-28  104  	return 0;
2164877c7f373e Christoph Hellwig 2021-07-28  105  fail:
2164877c7f373e Christoph Hellwig 2021-07-28  106  	kfree(new_subpart);
2164877c7f373e Christoph Hellwig 2021-07-28  107  	return ret;
2164877c7f373e Christoph Hellwig 2021-07-28  108  }
2164877c7f373e Christoph Hellwig 2021-07-28  109  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

only message in thread, other threads:[~2021-08-18 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 13:02 [linux-next:master 4326/8804] block/partitions/cmdline.c:100:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg] 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.