summaryrefslogtreecommitdiffstats
path: root/pcitool
diff options
context:
space:
mode:
authorVasilii Chernov <vchernov@inr.ru>2016-03-02 10:28:04 +0100
committerVasilii Chernov <vchernov@inr.ru>2016-03-02 10:28:04 +0100
commit8e7c95957ee73d6c11ef28f7c0e2319a11103783 (patch)
tree83df220932b3d88e071eda4c756e485dd48d50e9 /pcitool
parent8719b84a95805d109e21c20f05a0164315e1b38a (diff)
parent867bddcf7be374221a04b7ae89f93a5f5d703ee6 (diff)
downloadpcitool-8e7c95957ee73d6c11ef28f7c0e2319a11103783.tar.gz
pcitool-8e7c95957ee73d6c11ef28f7c0e2319a11103783.tar.bz2
pcitool-8e7c95957ee73d6c11ef28f7c0e2319a11103783.tar.xz
pcitool-8e7c95957ee73d6c11ef28f7c0e2319a11103783.zip
Merge with http://ufo.kit.edu/ufo/log/csa/pcitool 362 revision
Diffstat (limited to 'pcitool')
-rw-r--r--pcitool/cli.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pcitool/cli.c b/pcitool/cli.c
index 3f1af74..caa55a9 100644
--- a/pcitool/cli.c
+++ b/pcitool/cli.c
@@ -1291,9 +1291,11 @@ int ReadData(pcilib_t *handle, ACCESS_MODE mode, FLAGS flags, pcilib_dma_engine_
size = 2048; bytes = 0;
do {
- size *= 2;
- buf = realloc(buf, size);
- if (!buf) Error("Allocation of %zu bytes of memory has failed", size);
+ if ((size - bytes) < 4096) {
+ size *= 2;
+ buf = realloc(buf, size);
+ if (!buf) Error("Allocation of %zu bytes of memory has failed", size);
+ }
err = pcilib_read_dma_custom(handle, dmaid, addr, size - bytes, dma_flags, timeout, buf + bytes, &ret);
bytes += ret;