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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to