public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Rohland <cr@sap.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] tmpfs symlink size bug
Date: 29 Oct 2001 09:49:30 +0100	[thread overview]
Message-ID: <m3wv1ej0f9.fsf@linux.local> (raw)
In-Reply-To: <20011028103826.A17842@gondor.apana.org.au>

Hi Herbert,

On Sun, 28 Oct 2001, Herbert Xu wrote:
> Since 2.4.12 the size of symlinks on tmpfs has been off by one.  The
> following patch corrects that error.

Thanks for spotting. I prefer the following patch.

Alan, Linus, please apply.

Greetings
		Christoph

--- 2.4.13/mm/shmem.c	Sun Oct 28 16:59:03 2001
+++ t2.4.13/mm/shmem.c	Mon Oct 29 09:45:51 2001
@@ -1151,16 +1151,16 @@
 	if (error)
 		return error;
 
-	len = strlen(symname) + 1;
-	if (len > PAGE_CACHE_SIZE)
+	len = strlen(symname);
+	if (len >= PAGE_CACHE_SIZE)
 		return -ENAMETOOLONG;
 		
 	inode = dentry->d_inode;
 	info = SHMEM_I(inode);
 	inode->i_size = len;
-	if (len <= sizeof(struct shmem_inode_info)) {
+	if (len < sizeof(struct shmem_inode_info)) {
 		/* do it inline */
-		memcpy(info, symname, len);
+		memcpy(info, symname, len + 1);
 		inode->i_op = &shmem_symlink_inline_operations;
 	} else {
 		spin_lock (&shmem_ilock);
@@ -1173,7 +1173,7 @@
 			return PTR_ERR(page);
 		}
 		kaddr = kmap(page);
-		memcpy(kaddr, symname, len);
+		memcpy(kaddr, symname, len + 1);
 		kunmap(page);
 		SetPageDirty(page);
 		UnlockPage(page);


      reply	other threads:[~2001-10-29  8:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-27 23:38 [PATCH] tmpfs symlink size bug Herbert Xu
2001-10-29  8:49 ` Christoph Rohland [this message]

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=m3wv1ej0f9.fsf@linux.local \
    --to=cr@sap.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox