All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: Jerome de Vivie <jerome.devivie@free.fr>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Does struct qstr->name should be terminated ?
Date: Wed, 24 Mar 2004 10:09:26 +0100	[thread overview]
Message-ID: <20040324090926.GE28822@vagabond> (raw)
In-Reply-To: <406017C1.4080005@free.fr>

[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]

On Tue, Mar 23, 2004 at 11:56:01 +0100, Jerome de Vivie wrote:
> 
> I've work with "struct qstr" for a while without bothering with the last 
> caracter: qstr->name[qstr->len]. I get oops from my module but after 
> investigation, i found lines in fs/namei.c that are using this caracter:
> 
> In do_rename:
>         /* unless the source is a directory trailing slashes give 
> -ENOTDIR */
>         if (!S_ISDIR(old_dentry->d_inode->i_mode)) {
>                 error = -ENOTDIR;
>                 if (oldnd.last.name[oldnd.last.len])
>                         goto exit4;
>                 if (newnd.last.name[newnd.last.len])
>                         goto exit4;
>         }
> 
> So, do i need to initialize this caracter when allocating new qstr ? Is 
> this caracter is used in other place in the VFS ?

I'd think that it's treated as a nomral string in quite a few places, so
it needs to be NUL terminated. (But not searched the sources.)

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-03-24  9:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-23 10:56 Does struct qstr->name should be terminated ? Jerome de Vivie
2004-03-24  9:09 ` Jan Hudec [this message]
2004-03-24 13:05   ` Matthew Wilcox
2004-03-24 17:09     ` Bryan Henderson
2004-03-25  0:09       ` Jerome de Vivie

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=20040324090926.GE28822@vagabond \
    --to=bulb@ucw.cz \
    --cc=jerome.devivie@free.fr \
    --cc=linux-fsdevel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.