Skip to contentSkip to conversation

hfsplus: Missing O_LARGEFILE check

PATCH New Alan Cox 1 participant 2 messages Sep 23, 2008

Subsystems (2)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

hfsplus: O_LARGEFILE checking is missing

From: Alan Cox <[email protected]>

Closes #8490
---

 fs/hfsplus/inode.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/hfsplus/inode.c +2 -0
index b085d64..04af5a0 100644
@@ -254,6 +254,8 @@ static int hfsplus_file_open(struct inode *inode, struct file *file)
 {
 	if (HFSPLUS_IS_RSRC(inode))
 		inode = HFSPLUS_I(inode).rsrc_inode;
+	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
+		return -EOVERFLOW;
 	atomic_inc(&HFSPLUS_I(inode).opencnt);
 	return 0;
 }
author
#1 lore raw

PATCH 1/1 hfsplus: Missing O_LARGEFILE check (correct diff this time)

Sorry wrong version. Correct one attached

hfsplus: O_LARGEFILE checking is missing

From: Alan Cox <[email protected]>

Closes #8490
---

 fs/hfsplus/inode.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/hfsplus/inode.c +2 -0
index b085d64..963be64 100644
@@ -254,6 +254,8 @@ static int hfsplus_file_open(struct inode *inode, struct file *file)
 {
 	if (HFSPLUS_IS_RSRC(inode))
 		inode = HFSPLUS_I(inode).rsrc_inode;
+	if (!(file->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
+		return -EOVERFLOW;
 	atomic_inc(&HFSPLUS_I(inode).opencnt);
 	return 0;
 }