Re: [PATCH v3 04/12] powerpc: Prepare func_desc_t for refactorisation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Kees Cook <keescook@xxxxxxxxxxxx>
- Subject: Re: [PATCH v3 04/12] powerpc: Prepare func_desc_t for refactorisation
- From: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 11 Feb 2022 01:39:19 -0600
- Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx>, linux-arch@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, linux-mm@xxxxxxxxx, Paul Mackerras <paulus@xxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx
- In-reply-to: <202202101653.9128E58B84@keescook>
- References: <cover.1634457599.git.christophe.leroy@csgroup.eu> <86c393ce0a6f603f94e6d2ceca08d535f654bb23.1634457599.git.christophe.leroy@csgroup.eu> <202202101653.9128E58B84@keescook>
- User-agent: Mutt/1.4.2.3i
On Thu, Feb 10, 2022 at 04:54:52PM -0800, Kees Cook wrote:
> On Sun, Oct 17, 2021 at 02:38:17PM +0200, Christophe Leroy wrote:
(edited:)
> > +typedef struct {
> > + unsigned long addr;
> > +} func_desc_t;
> >
> > static func_desc_t func_desc(unsigned long addr)
> > {
> > + return (func_desc_t){addr};
> There's only 1 element in the struct, so okay, but it hurt my eyes a
> little. I would have been happier with:
>
> return (func_desc_t){ .addr = addr; };
>
> But of course that also looks bonkers because it starts with "return".
> So no matter what I do my eyes bug out. ;)
The usual way to avoid convoluted constructs is to name more factors.
So:
static func_desc_t func_desc(unsigned long addr)
{
func_desc_t desc = {};
desc.addr = addr;
return desc;
}
Segher
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]