Messages in this thread | | | Date | Tue, 18 Sep 2012 19:47:29 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH -mm v2] coredump: extend core dump note section to contain file names of mapped files |
| |
On 09/18, Oleg Nesterov wrote: > > Or perhaps 'filename = ""' case can handle this case itself. In this > case we do not even need strlen(), remaining = name - filename.
IOW. Denys, this is up to you and _iirc_ this was already discussed (just I don't remember the result), but perhaps
if (IS_ERR(filename)) { if (-ENAMETOOLONG) { ... goto retry; } remaining--; *name++ = 0; } else { remaining = name - filename; strcpy(name, filename); }
Hmm. And I just noticed that 'filename = ""' case does not verify there is a room to write a single '\0' :/
So, afaics you also need
- if (-ENAMETOOLONG) + if (-ENAMETOOLONG || !remaining)
or I missed something.
Oleg.
| |