diff options
Diffstat (limited to 'drivers/s390/crypto/zcrypt_cex2a.c')
-rw-r--r-- | drivers/s390/crypto/zcrypt_cex2a.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/s390/crypto/zcrypt_cex2a.c b/drivers/s390/crypto/zcrypt_cex2a.c index 54f4cbc3be9e..326ea08f67c9 100644 --- a/drivers/s390/crypto/zcrypt_cex2a.c +++ b/drivers/s390/crypto/zcrypt_cex2a.c | |||
@@ -264,17 +264,21 @@ static void zcrypt_cex2a_receive(struct ap_device *ap_dev, | |||
264 | .type = TYPE82_RSP_CODE, | 264 | .type = TYPE82_RSP_CODE, |
265 | .reply_code = REP82_ERROR_MACHINE_FAILURE, | 265 | .reply_code = REP82_ERROR_MACHINE_FAILURE, |
266 | }; | 266 | }; |
267 | struct type80_hdr *t80h = reply->message; | 267 | struct type80_hdr *t80h; |
268 | int length; | 268 | int length; |
269 | 269 | ||
270 | /* Copy the reply message to the request message buffer. */ | 270 | /* Copy the reply message to the request message buffer. */ |
271 | if (IS_ERR(reply)) | 271 | if (IS_ERR(reply)) { |
272 | memcpy(msg->message, &error_reply, sizeof(error_reply)); | 272 | memcpy(msg->message, &error_reply, sizeof(error_reply)); |
273 | else if (t80h->type == TYPE80_RSP_CODE) { | 273 | goto out; |
274 | } | ||
275 | t80h = reply->message; | ||
276 | if (t80h->type == TYPE80_RSP_CODE) { | ||
274 | length = min(CEX2A_MAX_RESPONSE_SIZE, (int) t80h->len); | 277 | length = min(CEX2A_MAX_RESPONSE_SIZE, (int) t80h->len); |
275 | memcpy(msg->message, reply->message, length); | 278 | memcpy(msg->message, reply->message, length); |
276 | } else | 279 | } else |
277 | memcpy(msg->message, reply->message, sizeof error_reply); | 280 | memcpy(msg->message, reply->message, sizeof error_reply); |
281 | out: | ||
278 | complete((struct completion *) msg->private); | 282 | complete((struct completion *) msg->private); |
279 | } | 283 | } |
280 | 284 | ||