From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
David Rientjes <rientjes@google.com>,
Kees Cook <keescook@chromium.org>,
Aaron Tomlin <atomlin@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] kernel/fork.c: avoid division by zero
Date: Tue, 17 Feb 2015 10:14:59 +0100 [thread overview]
Message-ID: <54E30693.8030004@gmx.de> (raw)
In-Reply-To: <20150217075636.GJ28367@esperanza>
On 17.02.2015 08:56, Vladimir Davydov wrote:
> On Mon, Feb 16, 2015 at 07:00:44PM +0100, Heinrich Schuchardt wrote:
>> diff --git a/kernel/fork.c b/kernel/fork.c
>> index cf65139..71e2583 100644
>> --- a/kernel/fork.c
>> +++ b/kernel/fork.c
>> @@ -273,7 +273,8 @@ void __init fork_init(unsigned long mempages)
>> * value: the thread structures can take up at most half
>> * of memory.
>> */
>> - max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE);
>> + max_threads = (u64) PAGE_SIZE * (u64) mempages
>> + / (u64) THREAD_SIZE / 8UL;
>
> This won't compile for a 32 bit arch, will it? Should you use div_u64?
>
> Thanks,
> Vladimir
>
Hello Vladimir,
I compiled the kernel successfully with the patch on a 32bit arm system
and Kernel 3.19.0.
Obviously that was good luck.
http://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html
describes that library function __udivti3 might be used on other
platforms. And using library functions is not allowable in the kernel.
Thank you for reviewing. I will update the patch.
Best regards
Heinrich
prev parent reply other threads:[~2015-02-17 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-16 18:00 [PATCH 1/1] kernel/fork.c: avoid division by zero Heinrich Schuchardt
2015-02-16 18:45 ` Heinrich Schuchardt
2015-02-16 18:49 ` Guenter Roeck
2015-02-17 7:56 ` Vladimir Davydov
2015-02-17 9:14 ` Heinrich Schuchardt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E30693.8030004@gmx.de \
--to=xypron.glpk@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=atomlin@redhat.com \
--cc=keescook@chromium.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
--cc=vdavydov@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox