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


Groups > linux.kernel > #1499509

Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf()

From Jes Sorensen <Jes.Sorensen@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf()
Date 2016-10-12 14:20 +0200
Message-ID <srqFP-4gb-15@gated-at.bofh.it> (permalink)
References (2 earlier) <spda1-6DS-23@gated-at.bofh.it> <spda1-6DS-21@gated-at.bofh.it> <spyet-5tC-17@gated-at.bofh.it> <sqIEO-1J7-33@gated-at.bofh.it> <srn5f-1KJ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Dan Carpenter <dan.carpenter@oracle.com> writes:
> Compare:
>
> 	foo = kmalloc(sizeof(*foo), GFP_KERNEL);
>
> This says you are allocating enough space for foo.  It can be reviewed
> by looking at one line.  If you change the type of foo it will still
> work.
>
> 	foo = kmalloc(sizeof(struct whatever), GFP_KERNEL);
>
> There isn't enough information to say if this is correct.  If you change
> the type of foo then you have to update the allocation as well.
>
> It's not a super common type of bug, but I see it occasionally.

I know what you are saying, but the latter in my book is easier to read
and reminds you what the type is when you review the code.

Point being this comes down to personal preference and stating that the
former is the right way or making that a rule and using checkpatch to
harrass people with patches to change it is bogus.

Jes

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


Thread

Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf() Richard Weinberger <richard.weinberger@gmail.com> - 2016-10-06 11:30 +0200
  Re: [PATCH 24/54] md/raid1: Improve another size determination in  setup_conf() Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-07 10:00 +0200
    Re: [PATCH 24/54] md/raid1: Improve another size determination in  setup_conf() Richard Weinberger <richard@nod.at> - 2016-10-07 10:20 +0200
    Re: md/raid1: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-07 11:00 +0200
      Re: md/raid1: Improve another size determination in setup_conf() Richard Weinberger <richard@nod.at> - 2016-10-07 11:10 +0200
        Re: md/raid1: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-07 13:00 +0200
          Re: md/raid1: Improve another size determination in setup_conf() "Austin S. Hemmelgarn" <ahferroin7@gmail.com> - 2016-10-07 14:00 +0200
            Re: md/raid1: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-07 17:30 +0200
              Re: md/raid1: Improve another size determination in setup_conf() Jiri Kosina <jikos@kernel.org> - 2016-10-07 17:40 +0200
                Re: md/raid1: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-07 18:40 +0200
                Re: md/raid1: Improve another size determination in setup_conf() Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-10-10 15:20 +0200
      Re: md/raid1: Improve another size determination in setup_conf() Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-10-10 15:10 +0200
        Re: md/raid1: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-10 15:30 +0200
          Re: md/raid1: Improve another size determination in setup_conf() Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-10-10 16:10 +0200
            Re: md/raid1: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-10 16:30 +0200
    Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf() Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-10-10 15:20 +0200
      Re: [PATCH 24/54] md/raid1: Improve another size determination in  setup_conf() Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-12 10:30 +0200
        Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf() Jes Sorensen <Jes.Sorensen@redhat.com> - 2016-10-12 14:20 +0200
  Re: [PATCH 24/54] md/raid1: Improve another size determination in  setup_conf() Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-10 13:20 +0200
    Re: md/raid1: Improve another size determination in setup_conf() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-10 14:30 +0200
    Re: [PATCH 24/54] md/raid1: Improve another size determination in setup_conf() Bjørn Mork <bjorn@mork.no> - 2016-10-10 16:10 +0200
    Re: [PATCH 24/54] md/raid1: Improve another size determination in  setup_conf() Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-11 08:30 +0200

csiph-web