[stgt] [PATCH 1/3] str_to_val macro, improved conversion and checking of numerical args

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Fri Nov 18 14:08:57 CET 2011


On Fri, 18 Nov 2011 13:39:05 +0200
Alexander Nezhinsky <alexandern at voltaire.com> wrote:

> When a numerical command line param value is out of range or contains
> garbage (both tgtd and tgtadm), this remains unchecked in many cases.
> In some of them 0 value will be used, which may lead to unpredicted or
> "silently" faulty behavior.
> 
> This fix defines a new macro str_to_val() which uses strtoull() and
> detects its errors properly, by checking
> 1) errno (range errors) and 2) comparing endptr to the original argument
> (they remain equal in case of non-numerical garbage);
> 
> Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
> ---
>  usr/util.h |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)

The patch series has been applied, thanks!
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list