mirror of
https://github.com/torvalds/linux.git
synced 2026-04-30 20:42:33 -04:00
s390/zcrypt: remove set_fs() invocation in zcrypt device driver
This patch reworks the zcrypt device driver so that the set_fs() invocation is not needed any more. Instead there is a new flag bool userspace passed through all the functions which tells if the pointer arguments are userspace or kernelspace. Together with the two new inline functions z_copy_from_user() and z_copy_to_user() which either invoke copy_from_user (userspace is true) or memcpy (userspace is false) the zcrypt dd and the AP bus now has no requirement for the set_fs() functionality any more. Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
committed by
Vasily Gorbik
parent
c360c9a238
commit
52f72feba9
@@ -59,9 +59,9 @@ struct zcrypt_ops {
|
||||
long (*rsa_modexpo)(struct zcrypt_queue *, struct ica_rsa_modexpo *);
|
||||
long (*rsa_modexpo_crt)(struct zcrypt_queue *,
|
||||
struct ica_rsa_modexpo_crt *);
|
||||
long (*send_cprb)(struct zcrypt_queue *, struct ica_xcRB *,
|
||||
long (*send_cprb)(bool userspace, struct zcrypt_queue *, struct ica_xcRB *,
|
||||
struct ap_message *);
|
||||
long (*send_ep11_cprb)(struct zcrypt_queue *, struct ep11_urb *,
|
||||
long (*send_ep11_cprb)(bool userspace, struct zcrypt_queue *, struct ep11_urb *,
|
||||
struct ap_message *);
|
||||
long (*rng)(struct zcrypt_queue *, char *, struct ap_message *);
|
||||
struct list_head list; /* zcrypt ops list. */
|
||||
@@ -145,4 +145,26 @@ void zcrypt_device_status_mask_ext(struct zcrypt_device_status_ext *devstatus);
|
||||
int zcrypt_device_status_ext(int card, int queue,
|
||||
struct zcrypt_device_status_ext *devstatus);
|
||||
|
||||
static inline unsigned long z_copy_from_user(bool userspace,
|
||||
void *to,
|
||||
const void __user *from,
|
||||
unsigned long n)
|
||||
{
|
||||
if (likely(userspace))
|
||||
return copy_from_user(to, from, n);
|
||||
memcpy(to, (void __force *) from, n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long z_copy_to_user(bool userspace,
|
||||
void __user *to,
|
||||
const void *from,
|
||||
unsigned long n)
|
||||
{
|
||||
if (likely(userspace))
|
||||
return copy_to_user(to, from, n);
|
||||
memcpy((void __force *) to, from, n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _ZCRYPT_API_H_ */
|
||||
|
||||
Reference in New Issue
Block a user