All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] ltp-aiodio/dio_sparse: Fix write in dio_sparse()
@ 2017-01-19  9:32 Guangwen Feng
  2017-01-19  9:32 ` [LTP] [PATCH 2/2] ltp-aiodio/dio_sparse: Fix usleep in read_sparse() Guangwen Feng
  2017-01-24 13:40 ` [LTP] [PATCH 1/2] ltp-aiodio/dio_sparse: Fix write in dio_sparse() Cyril Hrubis
  0 siblings, 2 replies; 15+ messages in thread
From: Guangwen Feng @ 2017-01-19  9:32 UTC (permalink / raw)
  To: ltp

Current code looks buggy because when the offset is greater than
or equal to the filesize, it will never happen to do the write
in the loop, as a result, ADSP080..ADSP087 do not work actually.
Fix it by making sure that we do write writesize bytes.

Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
---
 testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/io/ltp-aiodio/dio_sparse.c b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
index 41b9929..3828ed7 100644
--- a/testcases/kernel/io/ltp-aiodio/dio_sparse.c
+++ b/testcases/kernel/io/ltp-aiodio/dio_sparse.c
@@ -78,7 +78,7 @@ int dio_sparse(char *filename, int align, int writesize, int filesize, int offse
 
 	memset(bufptr, 0, writesize);
 	lseek(fd, offset, SEEK_SET);
-	for (i = offset; i < filesize;) {
+	for (i = 0; i < filesize;) {
 		if ((w = write(fd, bufptr, writesize)) != writesize) {
 			tst_resm(TBROK | TERRNO, "write() returned %d", w);
 			close(fd);
-- 
1.8.4.2




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

end of thread, other threads:[~2017-03-22 15:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-19  9:32 [LTP] [PATCH 1/2] ltp-aiodio/dio_sparse: Fix write in dio_sparse() Guangwen Feng
2017-01-19  9:32 ` [LTP] [PATCH 2/2] ltp-aiodio/dio_sparse: Fix usleep in read_sparse() Guangwen Feng
2017-01-24 13:43   ` Cyril Hrubis
2017-01-25  4:02     ` Guangwen Feng
2017-02-09  7:23       ` [LTP] [PATCH v2] " Guangwen Feng
2017-02-09  9:35         ` Cyril Hrubis
2017-02-14  3:20           ` Guangwen Feng
2017-03-21  8:08             ` [LTP] [PATCH] ltp-aiodio: Create the file before fork Guangwen Feng
2017-03-22 15:33               ` Cyril Hrubis
2017-01-24 13:40 ` [LTP] [PATCH 1/2] ltp-aiodio/dio_sparse: Fix write in dio_sparse() Cyril Hrubis
2017-01-25  4:33   ` Guangwen Feng
2017-02-09  8:56     ` Guangwen Feng
2017-02-09  9:31       ` Cyril Hrubis
2017-02-14  8:53         ` Guangwen Feng
2017-02-16 13:12           ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.