* [PATCH] tmpfs symlink size bug
@ 2001-10-27 23:38 Herbert Xu
2001-10-29 8:49 ` Christoph Rohland
0 siblings, 1 reply; 2+ messages in thread
From: Herbert Xu @ 2001-10-27 23:38 UTC (permalink / raw)
To: hans-christoph.rohland, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 330 bytes --]
Since 2.4.12 the size of symlinks on tmpfs has been off by one. The
following patch corrects that error.
--
Debian GNU/Linux 2.2 is out! ( http://www.debian.org/ )
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[-- Attachment #2: p --]
[-- Type: text/plain, Size: 543 bytes --]
Index: mm/shmem.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.4/mm/shmem.c,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 shmem.c
--- mm/shmem.c 17 Oct 2001 21:19:20 -0000 1.1.1.16
+++ mm/shmem.c 27 Oct 2001 23:34:51 -0000
@@ -1157,7 +1157,7 @@
inode = dentry->d_inode;
info = SHMEM_I(inode);
- inode->i_size = len;
+ inode->i_size = len - 1;
if (len <= sizeof(struct shmem_inode_info)) {
/* do it inline */
memcpy(info, symname, len);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tmpfs symlink size bug
2001-10-27 23:38 [PATCH] tmpfs symlink size bug Herbert Xu
@ 2001-10-29 8:49 ` Christoph Rohland
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Rohland @ 2001-10-29 8:49 UTC (permalink / raw)
To: Herbert Xu; +Cc: linux-kernel, Linus Torvalds, Alan Cox
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-10-29 8:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-27 23:38 [PATCH] tmpfs symlink size bug Herbert Xu
2001-10-29 8:49 ` Christoph Rohland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox