mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
s390/zcrypt: Locate ep11_domain_query_info onto the stack instead of kmalloc
Locate the relative small struct ep11_domain_query_info variable onto the stack instead of kmalloc()/kfree(). Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Holger Dengler <dengler@linux.ibm.com> Link: https://lore.kernel.org/r/20250424133619.16495-18-freude@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
9eb61e71d7
commit
e9f45ef675
|
|
@ -702,36 +702,31 @@ int ep11_get_domain_info(u16 card, u16 domain, struct ep11_domain_info *info)
|
|||
u8 new_WK_VP[32];
|
||||
u32 dom_flags;
|
||||
u64 op_mode;
|
||||
} __packed * p_dom_info;
|
||||
|
||||
p_dom_info = kmalloc(sizeof(*p_dom_info), GFP_KERNEL);
|
||||
if (!p_dom_info)
|
||||
return -ENOMEM;
|
||||
} __packed dom_query_info;
|
||||
|
||||
rc = ep11_query_info(card, domain, 0x03 /* domain info query */,
|
||||
sizeof(*p_dom_info), (u8 *)p_dom_info);
|
||||
sizeof(dom_query_info), (u8 *)&dom_query_info);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->cur_wk_state = '0';
|
||||
info->new_wk_state = '0';
|
||||
if (p_dom_info->dom_flags & 0x10 /* left imprint mode */) {
|
||||
if (p_dom_info->dom_flags & 0x02 /* cur wk valid */) {
|
||||
if (dom_query_info.dom_flags & 0x10 /* left imprint mode */) {
|
||||
if (dom_query_info.dom_flags & 0x02 /* cur wk valid */) {
|
||||
info->cur_wk_state = '1';
|
||||
memcpy(info->cur_wkvp, p_dom_info->cur_WK_VP, 32);
|
||||
memcpy(info->cur_wkvp, dom_query_info.cur_WK_VP, 32);
|
||||
}
|
||||
if (p_dom_info->dom_flags & 0x04 || /* new wk present */
|
||||
p_dom_info->dom_flags & 0x08 /* new wk committed */) {
|
||||
if (dom_query_info.dom_flags & 0x04 || /* new wk present */
|
||||
dom_query_info.dom_flags & 0x08 /* new wk committed */) {
|
||||
info->new_wk_state =
|
||||
p_dom_info->dom_flags & 0x08 ? '2' : '1';
|
||||
memcpy(info->new_wkvp, p_dom_info->new_WK_VP, 32);
|
||||
dom_query_info.dom_flags & 0x08 ? '2' : '1';
|
||||
memcpy(info->new_wkvp, dom_query_info.new_WK_VP, 32);
|
||||
}
|
||||
}
|
||||
info->op_mode = p_dom_info->op_mode;
|
||||
info->op_mode = dom_query_info.op_mode;
|
||||
|
||||
out:
|
||||
kfree(p_dom_info);
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(ep11_get_domain_info);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user