Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1493402

Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()

From Paul Bolle <pebolle@tiscali.nl>
Newsgroups linux.kernel
Subject Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash()
Date 2016-09-29 13:20 +0200
Message-ID <smHxD-3qa-7@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <smFvP-250-3@gated-at.bofh.it> <smFvP-250-1@gated-at.bofh.it> <smGid-2kN-3@gated-at.bofh.it> <smGrU-2Dz-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2016-09-29 at 03:02 -0700, Joe Perches wrote:
> What's the false positive?
> 
> I get:
> 
> $ ./scripts/checkpatch.pl -f drivers/md/dm-snap.c --show-types --types=alloc_with_multiply
> WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
> #329: FILE: drivers/md/dm-snap.c:329:
> +	_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
> 
> WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply
> #338: FILE: drivers/md/dm-snap.c:338:
> +	_dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head),
> 
> total: 0 errors, 2 warnings, 2490 lines checked
> 
> NOTE: For some of the reported defects, checkpatch may be able to
>       mechanically convert to the typical style using --fix or --fix-inplace.
> 
> drivers/md/dm-snap.c has style problems, please review.
> 
> NOTE: Used message types: ALLOC_WITH_MULTIPLY
> 
> NOTE: If any of the errors are false positives, please report
>       them to the maintainer, see CHECKPATCH in MAINTAINERS.

It seems it was intended to be silent about multiplying with constants,
where things that look like preprocessor defines are also considered
constants. Or did I misread that test?


Paul Bolle

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-29 11:10 +0200
  Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Paul Bolle <pebolle@tiscali.nl> - 2016-09-29 12:00 +0200
    Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Joe Perches <joe@perches.com> - 2016-09-29 12:10 +0200
      Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Paul Bolle <pebolle@tiscali.nl> - 2016-09-29 13:20 +0200
        Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Paul Bolle <pebolle@tiscali.nl> - 2016-09-29 13:50 +0200
          Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Joe Perches <joe@perches.com> - 2016-09-29 17:10 +0200
            Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Paul Bolle <pebolle@tiscali.nl> - 2016-09-29 21:50 +0200
              Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Joe Perches <joe@perches.com> - 2016-09-29 22:30 +0200
                Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Paul Bolle <pebolle@tiscali.nl> - 2016-09-29 22:50 +0200
                Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Joe Perches <joe@perches.com> - 2016-09-29 23:00 +0200
                Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Paul Bolle <pebolle@tiscali.nl> - 2016-09-29 23:20 +0200
                Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Joe Perches <joe@perches.com> - 2016-09-29 23:30 +0200
                Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in  init_origin_hash() Paul Bolle <pebolle@tiscali.nl> - 2016-09-29 23:50 +0200
                Re: dm snapshot: Use kmalloc_array() in init_origin_hash() ? SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-30 09:20 +0200
    Re: dm snapshot: Use kmalloc_array() in init_origin_hash() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-29 13:50 +0200
      Re: dm snapshot: Use kmalloc_array() in init_origin_hash() Theodore Ts'o <tytso@mit.edu> - 2016-09-29 15:10 +0200

csiph-web