Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

s390/zcrypt: Make apfs a real unsigned int field

Slight rework on the apfs field: Instead of unsigned char[4]
make this a real 32 bit unsigned int field. With that done,
some assignments and some printouts can be simplified.
With that comes a slight move of the anonymous struct covering
the message type 86 header to dedupe some code lines.

Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Harald Freudenberger and committed by
Vasily Gorbik
ecd2fd11 e2c6d91e

+13 -21
+10 -18
drivers/s390/crypto/zcrypt_error.h
··· 78 78 static inline int convert_error(struct zcrypt_queue *zq, 79 79 struct ap_message *reply) 80 80 { 81 - struct error_hdr *ehdr = reply->msg; 82 - int card = AP_QID_CARD(zq->queue->qid); 83 81 int queue = AP_QID_QUEUE(zq->queue->qid); 82 + int card = AP_QID_CARD(zq->queue->qid); 83 + struct error_hdr *ehdr = reply->msg; 84 + struct { 85 + struct type86_hdr hdr; 86 + struct type86_fmt2_ext fmt2; 87 + } __packed * t86hdr = reply->msg; 84 88 85 89 switch (ehdr->reply_code) { 86 90 case REP82_ERROR_INVALID_MSG_LEN: /* 0x23 */ ··· 104 100 /* RY indicates malformed request */ 105 101 if (ehdr->reply_code == REP82_ERROR_FILTERED_BY_HYPERVISOR && 106 102 ehdr->type == TYPE86_RSP_CODE) { 107 - struct { 108 - struct type86_hdr hdr; 109 - struct type86_fmt2_ext fmt2; 110 - } __packed * head = reply->msg; 111 - unsigned int apfs = *((u32 *)head->fmt2.apfs); 112 - 113 103 ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x apfs=0x%x => rc=EINVAL\n", 114 104 __func__, card, queue, 115 - ehdr->reply_code, apfs); 105 + ehdr->reply_code, t86hdr->fmt2.apfs); 116 106 } else { 117 107 ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x => rc=EINVAL\n", 118 - __func__, card, queue, 119 - ehdr->reply_code); 108 + __func__, card, queue, ehdr->reply_code); 120 109 } 121 110 return -EINVAL; 122 111 case REP82_ERROR_MACHINE_FAILURE: /* 0x10 */ ··· 122 125 /* For type 86 response show the apfs value (failure reason) */ 123 126 if (ehdr->reply_code == REP82_ERROR_TRANSPORT_FAIL && 124 127 ehdr->type == TYPE86_RSP_CODE) { 125 - struct { 126 - struct type86_hdr hdr; 127 - struct type86_fmt2_ext fmt2; 128 - } __packed * head = reply->msg; 129 - unsigned int apfs = *((u32 *)head->fmt2.apfs); 130 - 131 128 ZCRYPT_DBF_WARN( 132 129 "%s dev=%02x.%04x RY=0x%02x apfs=0x%x => bus rescan, rc=EAGAIN\n", 133 - __func__, card, queue, ehdr->reply_code, apfs); 130 + __func__, card, queue, ehdr->reply_code, 131 + t86hdr->fmt2.apfs); 134 132 } else { 135 133 ZCRYPT_DBF_WARN("%s dev=%02x.%04x RY=0x%02x => bus rescan, rc=EAGAIN\n", 136 134 __func__, card, queue,
+1 -1
drivers/s390/crypto/zcrypt_msgtype6.c
··· 753 753 return convert_error(zq, reply); 754 754 case TYPE86_RSP_CODE: 755 755 if (msg->hdr.reply_code) { 756 - memcpy(&xcrb->status, msg->fmt2.apfs, sizeof(u32)); 756 + xcrb->status = msg->fmt2.apfs; 757 757 return convert_error(zq, reply); 758 758 } 759 759 if (msg->cprbx.cprb_ver_id == 0x02)
+2 -2
drivers/s390/crypto/zcrypt_msgtype6.h
··· 34 34 unsigned char right[4]; /* 0x00000000 */ 35 35 unsigned char reserved3[2]; /* 0x0000 */ 36 36 unsigned char reserved4[2]; /* 0x0000 */ 37 - unsigned char apfs[4]; /* 0x00000000 */ 37 + unsigned int apfs; /* 0x00000000 */ 38 38 unsigned int offset1; /* 0x00000058 (offset to CPRB) */ 39 39 unsigned int offset2; /* 0x00000000 */ 40 40 unsigned int offset3; /* 0x00000000 */ ··· 83 83 84 84 struct type86_fmt2_ext { 85 85 unsigned char reserved[4]; /* 0x00000000 */ 86 - unsigned char apfs[4]; /* final status */ 86 + unsigned int apfs; /* final status */ 87 87 unsigned int count1; /* length of CPRB + parameters */ 88 88 unsigned int offset1; /* offset to CPRB */ 89 89 unsigned int count2; /* 0x00000000 */