mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-27 03:49:57 -04:00
KVM: selftests: Add atoi_paranoid() to catch errors missed by atoi()
atoi() doesn't detect errors. There is no way to know that a 0 return is correct conversion or due to an error. Introduce atoi_paranoid() to detect errors and provide correct conversion. Replace all atoi() calls with atoi_paranoid(). Signed-off-by: Vipin Sharma <vipinsh@google.com> Suggested-by: David Matlack <dmatlack@google.com> Suggested-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221103191719.1559407-4-vipinsh@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
committed by
Sean Christopherson
parent
0eb88a4121
commit
018ea2d71a
@@ -368,7 +368,7 @@ int main(int argc, char *argv[])
|
||||
params.vcpu_memory_bytes = parse_size(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
params.nr_vcpus = atoi(optarg);
|
||||
params.nr_vcpus = atoi_paranoid(optarg);
|
||||
break;
|
||||
case 'o':
|
||||
overlap_memory_access = true;
|
||||
|
||||
Reference in New Issue
Block a user