[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160302142856.GJ16954@pd.tnic>
Date: Wed, 2 Mar 2016 15:28:57 +0100
From: Borislav Petkov <bp@...en8.de>
To: One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Cc: Andy Lutomirski <luto@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Brian Gerst <brgerst@...il.com>
Subject: Re: [PATCH 01/10] selftests/x86: In syscall_nt, test NT|TF as well
On Wed, Mar 02, 2016 at 02:01:15PM +0000, One Thousand Gnomes wrote:
> int main(void) is wrong as there are passed arguments
Not in this particular case - test doesn't take args.
> int main() is ok (in C89 at least) because it means "there are unknown
> arguments"
>
> int main(int argc, char *argv[]) is allowed
>
> int main(void) is not safe on all platforms because some compilers
> choose to do the argument cleanup in the return path of the called
> function. Having the wrong number of arguments doesn't end well in such
> cases. I doubt any Linux platforms do this but we shouldn't be
> encouraging bad programming techniques 8)
There's also the variadic thing. Here's hpa's sermon from a couple of
years ago:
http://thread.gmane.org/gmane.linux.kernel/1268751/focus=1268792
:-))))
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
Powered by blists - more mailing lists