@@ -376,6 +376,7 @@ static int sev_ioctl_do_pek_csr(struct sev_issue_cmd *argp, bool writable)
376
376
struct sev_device * sev = psp_master -> sev_data ;
377
377
struct sev_user_data_pek_csr input ;
378
378
struct sev_data_pek_csr * data ;
379
+ void __user * input_address ;
379
380
void * blob = NULL ;
380
381
int ret ;
381
382
@@ -394,6 +395,7 @@ static int sev_ioctl_do_pek_csr(struct sev_issue_cmd *argp, bool writable)
394
395
goto cmd ;
395
396
396
397
/* allocate a physically contiguous buffer to store the CSR blob */
398
+ input_address = (void __user * )input .address ;
397
399
if (input .length > SEV_FW_BLOB_MAX_SIZE ) {
398
400
ret = - EFAULT ;
399
401
goto e_free ;
@@ -426,7 +428,7 @@ static int sev_ioctl_do_pek_csr(struct sev_issue_cmd *argp, bool writable)
426
428
}
427
429
428
430
if (blob ) {
429
- if (copy_to_user (( void __user * ) input . address , blob , input .length ))
431
+ if (copy_to_user (input_address , blob , input .length ))
430
432
ret = - EFAULT ;
431
433
}
432
434
@@ -437,7 +439,7 @@ static int sev_ioctl_do_pek_csr(struct sev_issue_cmd *argp, bool writable)
437
439
return ret ;
438
440
}
439
441
440
- void * psp_copy_user_blob (u64 __user uaddr , u32 len )
442
+ void * psp_copy_user_blob (u64 uaddr , u32 len )
441
443
{
442
444
if (!uaddr || !len )
443
445
return ERR_PTR (- EINVAL );
@@ -446,7 +448,7 @@ void *psp_copy_user_blob(u64 __user uaddr, u32 len)
446
448
if (len > SEV_FW_BLOB_MAX_SIZE )
447
449
return ERR_PTR (- EINVAL );
448
450
449
- return memdup_user ((void __user * )( uintptr_t ) uaddr , len );
451
+ return memdup_user ((void __user * )uaddr , len );
450
452
}
451
453
EXPORT_SYMBOL_GPL (psp_copy_user_blob );
452
454
@@ -621,6 +623,7 @@ static int sev_ioctl_do_get_id2(struct sev_issue_cmd *argp)
621
623
{
622
624
struct sev_user_data_get_id2 input ;
623
625
struct sev_data_get_id * data ;
626
+ void __user * input_address ;
624
627
void * id_blob = NULL ;
625
628
int ret ;
626
629
@@ -631,6 +634,8 @@ static int sev_ioctl_do_get_id2(struct sev_issue_cmd *argp)
631
634
if (copy_from_user (& input , (void __user * )argp -> data , sizeof (input )))
632
635
return - EFAULT ;
633
636
637
+ input_address = (void __user * )input .address ;
638
+
634
639
data = kzalloc (sizeof (* data ), GFP_KERNEL );
635
640
if (!data )
636
641
return - ENOMEM ;
@@ -660,8 +665,7 @@ static int sev_ioctl_do_get_id2(struct sev_issue_cmd *argp)
660
665
}
661
666
662
667
if (id_blob ) {
663
- if (copy_to_user ((void __user * )input .address ,
664
- id_blob , data -> len )) {
668
+ if (copy_to_user (input_address , id_blob , data -> len )) {
665
669
ret = - EFAULT ;
666
670
goto e_free ;
667
671
}
@@ -720,6 +724,8 @@ static int sev_ioctl_do_pdh_export(struct sev_issue_cmd *argp, bool writable)
720
724
struct sev_user_data_pdh_cert_export input ;
721
725
void * pdh_blob = NULL , * cert_blob = NULL ;
722
726
struct sev_data_pdh_cert_export * data ;
727
+ void __user * input_cert_chain_address ;
728
+ void __user * input_pdh_cert_address ;
723
729
int ret ;
724
730
725
731
/* If platform is not in INIT state then transition it to INIT. */
@@ -745,6 +751,9 @@ static int sev_ioctl_do_pdh_export(struct sev_issue_cmd *argp, bool writable)
745
751
!input .cert_chain_address )
746
752
goto cmd ;
747
753
754
+ input_pdh_cert_address = (void __user * )input .pdh_cert_address ;
755
+ input_cert_chain_address = (void __user * )input .cert_chain_address ;
756
+
748
757
/* Allocate a physically contiguous buffer to store the PDH blob. */
749
758
if (input .pdh_cert_len > SEV_FW_BLOB_MAX_SIZE ) {
750
759
ret = - EFAULT ;
@@ -788,15 +797,15 @@ static int sev_ioctl_do_pdh_export(struct sev_issue_cmd *argp, bool writable)
788
797
}
789
798
790
799
if (pdh_blob ) {
791
- if (copy_to_user (( void __user * ) input . pdh_cert_address ,
800
+ if (copy_to_user (input_pdh_cert_address ,
792
801
pdh_blob , input .pdh_cert_len )) {
793
802
ret = - EFAULT ;
794
803
goto e_free_cert ;
795
804
}
796
805
}
797
806
798
807
if (cert_blob ) {
799
- if (copy_to_user (( void __user * ) input . cert_chain_address ,
808
+ if (copy_to_user (input_cert_chain_address ,
800
809
cert_blob , input .cert_chain_len ))
801
810
ret = - EFAULT ;
802
811
}
0 commit comments