changeset 47:27d423daf8ec

8058440: OOM at SPIDEvice.writeAndRead with 'skip' equals to write buffer lenght Reviewed-by: jld
author alkonsta
date Tue, 16 Sep 2014 17:22:50 +0400
parents c4e318929675
children 1b480a94749a
files src/share/classes/com/oracle/dio/spibus/impl/SPISlaveImpl.java
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/spibus/impl/SPISlaveImpl.java	Mon Sep 15 18:00:42 2014 +0400
+++ b/src/share/classes/com/oracle/dio/spibus/impl/SPISlaveImpl.java	Tue Sep 16 17:22:50 2014 +0400
@@ -548,12 +548,16 @@
                     }
                 }
 
-                if (skip > 0 && null != toRecv) {
-                    // ability to fit 'skip' bytes was checked above (see if (toSend.remaining() <= skip) )
-                    toRecv.position(skip);
-                    skip = 0;
+                if (skip > 0) {
+                    if(null != toRecv) {
+                        // ability to fit 'skip' bytes was checked above (see if (toSend.remaining() <= skip) )
+                        toRecv.position(skip);
+                        skip = 0;
+                    } else {
+                        skip-=toSend.remaining();
+                    }
                 }
-                if (null != dst && 0 == skip) {
+                if (null != toRecv) {
                     // transaction requires postponed reverse copying
                     if (null != localActions) {
                         final ByteBuffer to = dst.slice();