[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] ping: [PATCH v13] block/raw-posix.c: Make

From: Kevin Wolf
Subject: Re: [Qemu-block] [Qemu-devel] ping: [PATCH v13] block/raw-posix.c: Make physical devices usable in QEMU under Mac OS X host
Date: Wed, 3 Feb 2016 11:37:10 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Am 02.02.2016 um 20:29 hat Eric Blake geschrieben:
> On 02/02/2016 10:28 AM, Programmingkid wrote:
> >> Whats the rationale here ? Using pre-allocated fixed
> >> length arrays is pretty bad practice in general, but
> >> especially so for filenames
> > 
> > With an automatic variable there is no worry about when to release it. 
> Yeah, but it comes with the downside of having to worry about exhausting
> stack space (there are platforms where MAXPATHLEN is intentionally
> undefined [hello, GNU Hurd]), or with the downside of arbitrary
> limitations.  And at the same time, MAXPATHLEN is usually wasteful -
> allocating 1k or 4k of stack to store what is typically less than 100
> bytes is dumb.  Really, storing file names in fixed length arrays is
> better off to avoid, and just get used to dynamic management.

Just let me add that while it's probably harmless here in .bdrv_open(),
other paths in the block layer which run in a coroutine have a much more
limited stack size and the danger of stack overflows is very real there.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]