Skip to content

Commit 7371c0a

Browse files
ddstreetherbertx
authored andcommitted
crypto: nx - don't err if compressed output > input
Return success instead of error if compression succeeds but the output is larger than the input. It's unlikely that the caller will use the compressed data since it's larger than the original uncompressed data, but there was no error and returning an error code is incorrect. Further, for testing small input buffers, the output is likely to be larger than the input and success needs to be returned to verify the test. Signed-off-by: Dan Streetman <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent caa8c50 commit 7371c0a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/crypto/nx/nx-842-pseries.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,12 @@ static int nx842_validate_result(struct device *dev,
226226
switch (csb->completion_code) {
227227
case 0: /* Completed without error */
228228
break;
229-
case 64: /* Target bytes > Source bytes during compression */
229+
case 64: /* Compression ok, but output larger than input */
230+
dev_dbg(dev, "%s: output size larger than input size\n",
231+
__func__);
232+
break;
230233
case 13: /* Output buffer too small */
231-
dev_dbg(dev, "%s: Compression output larger than input\n",
234+
dev_dbg(dev, "%s: Out of space in output buffer\n",
232235
__func__);
233236
return -ENOSPC;
234237
case 66: /* Input data contains an illegal template field */

0 commit comments

Comments
 (0)