File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -5344,21 +5344,10 @@ static int bpf_task_fd_query_copy(const union bpf_attr *attr,
53445344
53455345 if (put_user (zero , ubuf ))
53465346 return - EFAULT ;
5347- } else if (input_len >= len + 1 ) {
5348- /* ubuf can hold the string with NULL terminator */
5349- if (copy_to_user (ubuf , buf , len + 1 ))
5350- return - EFAULT ;
53515347 } else {
5352- /* ubuf cannot hold the string with NULL terminator,
5353- * do a partial copy with NULL terminator.
5354- */
5355- char zero = '\0' ;
5356-
5357- err = - ENOSPC ;
5358- if (copy_to_user (ubuf , buf , input_len - 1 ))
5359- return - EFAULT ;
5360- if (put_user (zero , ubuf + input_len - 1 ))
5361- return - EFAULT ;
5348+ err = bpf_copy_to_user (ubuf , buf , input_len , len );
5349+ if (err == - EFAULT )
5350+ return err ;
53625351 }
53635352 }
53645353
You can’t perform that action at this time.
0 commit comments