Message ID | 1b3cc602d61a1b0a5383a481452d216331e3477e.1741304303.git.alison.schofield@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Address Coverity Scan Defects | expand |
diff --git a/ndctl/namespace.c b/ndctl/namespace.c index aa8c23a50385..372fc3747c88 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -868,6 +868,13 @@ static int validate_namespace_options(struct ndctl_region *region, p->size /= size_align; p->size++; + + if (p->size > ULLONG_MAX / size_align) { + err("size overflow: %llu * %llu exceeds ULLONG_MAX\n", + p->size, size_align); + return -EINVAL; + } + p->size *= size_align; p->size /= units; err("'--size=' must align to interleave-width: %d and alignment: %ld\n"