public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] bin/ftest02: Fix negative lseek offset expression.
@ 2017-03-02 16:52 Steve Ellcey
  2017-03-03  9:48 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Ellcey @ 2017-03-02 16:52 UTC (permalink / raw)
  To: ltp

Cast the result of sizeof to (off_t) so that we have a signed value
before we negate it.  Otherwise we will get the wrong value in cases
where sizeof returns a 32 bit unsigned type and off_t is a 64 bit
signed type.  This problem shows up on x86_64 when compiling with
-mx32.

This fixes LTP issue #135.

Signed-off-by: Steve Ellcey <sellcey@caviumnetworks.com>
---
 testcases/kernel/fs/ftest/ftest02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/fs/ftest/ftest02.c b/testcases/kernel/fs/ftest/ftest02.c
index f205961..a416a98 100644
--- a/testcases/kernel/fs/ftest/ftest02.c
+++ b/testcases/kernel/fs/ftest/ftest02.c
@@ -268,7 +268,7 @@ static void crfile(int me, int count)
 	val = write(fd, crmsg, sizeof(crmsg) - 1);
 	warn(val, "write", 0);
 
-	val = lseek(fd, -(sizeof(crmsg) - 1), 1);
+	val = lseek(fd, -((off_t) sizeof(crmsg) - 1), 1);
 	warn(val, "lseek", 0);
 
 	val = read(fd, buf, sizeof(crmsg) - 1);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [LTP] [PATCH v2] bin/ftest02: Fix negative lseek offset expression.
  2017-03-02 16:52 [LTP] [PATCH v2] bin/ftest02: Fix negative lseek offset expression Steve Ellcey
@ 2017-03-03  9:48 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2017-03-03  9:48 UTC (permalink / raw)
  To: ltp

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-03  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-02 16:52 [LTP] [PATCH v2] bin/ftest02: Fix negative lseek offset expression Steve Ellcey
2017-03-03  9:48 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox