From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Rees Subject: Re: [PATCH] SUNRPC: Prevent kernel stack corruption on long values of flush Date: Wed, 18 Jul 2012 16:55:10 -0400 Message-ID: <20120718205510.GA18374@umich.edu> References: <1342476086-21638-1-git-send-email-levinsasha928@gmail.com> <20120718173913.GA1298@fieldses.org> <20120718200049.GA17964@umich.edu> <20120718203304.GA18540@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: Dave Jones , "J. Bruce Fields" , Sasha Levin , Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org, davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Return-path: Content-Disposition: inline In-Reply-To: <20120718203304.GA18540-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Sender: linux-nfs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: netdev.vger.kernel.org Dave Jones wrote: On Wed, Jul 18, 2012 at 04:00:49PM -0400, Jim Rees wrote: > You could use something like: > > char tbuf[sizeof (unsigned long) * 24 / 10 + 1 + 2]; /* + 2 for final "\n\0" */ > > since there are roughly 10 bits for every 3 decimal digits. > > But I'm obviously confused, because I don't understand why tbuf needs to be > any more than 10 + 2. Unsigned long isn't necessarily 32 bits. On 64-bit systems %lu can be up to 18446744073709551615 Thanks. You caught me thinking "Intel." How embarrassing. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html