From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Hudec Subject: Re: Does struct qstr->name should be terminated ? Date: Wed, 24 Mar 2004 10:09:26 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040324090926.GE28822@vagabond> References: <406017C1.4080005@free.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qOrJKOH36bD5yhNe" Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from cimice4.lam.cz ([212.71.168.94]:27606 "EHLO vagabond.light.src") by vger.kernel.org with ESMTP id S263105AbUCXJOe (ORCPT ); Wed, 24 Mar 2004 04:14:34 -0500 To: Jerome de Vivie Content-Disposition: inline In-Reply-To: <406017C1.4080005@free.fr> List-Id: linux-fsdevel.vger.kernel.org --qOrJKOH36bD5yhNe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 23, 2004 at 11:56:01 +0100, Jerome de Vivie wrote: >=20 > I've work with "struct qstr" for a while without bothering with the last= =20 > caracter: qstr->name[qstr->len]. I get oops from my module but after=20 > investigation, i found lines in fs/namei.c that are using this caracter: >=20 > In do_rename: > /* unless the source is a directory trailing slashes give=20 > -ENOTDIR */ > if (!S_ISDIR(old_dentry->d_inode->i_mode)) { > error =3D -ENOTDIR; > if (oldnd.last.name[oldnd.last.len]) > goto exit4; > if (newnd.last.name[newnd.last.len]) > goto exit4; > } >=20 > So, do i need to initialize this caracter when allocating new qstr ? Is= =20 > 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 --qOrJKOH36bD5yhNe Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAYVBGRel1vVwhjGURAiq3AKDbKzcqY2acggBkdW4Quh62zl02AwCePuDM jjjgkudml2ptRXe/ZW7xyPw= =Aob0 -----END PGP SIGNATURE----- --qOrJKOH36bD5yhNe--