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


Groups > linux.kernel > #1478511

Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes()

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes()
Date 2016-09-07 19:10 +0200
Message-ID <seOwi-2yo-21@gated-at.bofh.it> (permalink)
References (4 earlier) <seJdg-7vS-13@gated-at.bofh.it> <seJdg-7vS-27@gated-at.bofh.it> <seJwD-7Cz-41@gated-at.bofh.it> <seNTB-25W-45@gated-at.bofh.it> <seO3g-298-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Sep 7, 2016 at 9:37 AM, Joe Perches <joe@perches.com> wrote:
> On Wed, 2016-09-07 at 09:23 -0700, Kees Cook wrote:
>> Fixing these kmalloc calls would be a nice thing to clean up
>> everywhere.
>
> Dubious as gcc cannot currently optimize known small fixed size
> allocations with alloc_array and will always perform the
> multiplication.

Oh, that's sad. Is it not able to tell what the types are to basic
overflow validation? Could we help gcc in some way?

> Also the style of sizeof(*ptr) is not always as clear, obvious
> nor as easy to grep as sizeof(type).

I've always been on the fence about this (I like being able to see
destination:thing, sizeof(*thing) for easy scanning), but having the
type right there can be easier for text searches.

-Kees

-- 
Kees Cook
Nexus Security

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


Thread

[PATCH] x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-04 22:30 +0200
  Re: [PATCH] x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() Kees Cook <keescook@chromium.org> - 2016-09-07 00:00 +0200
    Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-07 10:00 +0200
      Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() Paolo Bonzini <pbonzini@redhat.com> - 2016-09-07 12:40 +0200
        Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-07 13:30 +0200
          Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() Paolo Bonzini <pbonzini@redhat.com> - 2016-09-07 13:30 +0200
            Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-07 13:50 +0200
              Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() Kees Cook <keescook@chromium.org> - 2016-09-07 18:30 +0200
                Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() Joe Perches <joe@perches.com> - 2016-09-07 18:40 +0200
                Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() Kees Cook <keescook@chromium.org> - 2016-09-07 19:10 +0200
                Re: x86-ksysfs: Use kmalloc_array() in create_setup_data_nodes() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-07 19:00 +0200

csiph-web