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


Groups > linux.kernel > #1546770

Re: [PATCH] serial: 8250: use initializer instead of memset to clear local struct

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH] serial: 8250: use initializer instead of memset to clear local struct
Date 2016-12-23 08:30 +0100
Message-ID <sRssF-3RI-5@gated-at.bofh.it> (permalink)
References <sRoIp-1sK-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Dec 23, 2016 at 12:21:48PM +0900, Masahiro Yamada wrote:
> Leave the way of zero-out to the compiler's decision; the compiler
> may know a more optimized way than calling memset().

But no, it doesn't, it will leave "blank" areas in the structure with
bad data in it, which is why we do memset.  See the tree-wide fixups we
made about a year ago for this very issue.  Are you sure none of these
structures get copied to userspace?

> It may end up with memset() for big structures like this after all,
> but the code will be cleaner at least.

Please leave it as-is, unless you see a measured speedup.

thanks,

greg k-h

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


Thread

[PATCH] serial: 8250: use initializer instead of memset to clear local struct Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-12-23 04:30 +0100
  Re: [PATCH] serial: 8250: use initializer instead of memset to clear  local struct Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-12-23 08:30 +0100
    Re: [PATCH] serial: 8250: use initializer instead of memset to clear  local struct Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-12-24 07:50 +0100
    Re: [PATCH] serial: 8250: use initializer instead of memset to clear  local struct Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-01-02 14:30 +0100

csiph-web