HomeFreeBSD

Fix userquota_compare() function

Description

Fix userquota_compare() function

The AVL tree compare function requires that either -1, 0, or 1 be
returned. However the strcmp() function only guarantees that a
negative, zero, or positive value is returned. Therefore, the
return value of strcmp() needs to be sanitized with AVL_ISIGN.

This was initially overlooked because the x86_64 implementation
of strcmp() happens to only returns the allowed values. This
was observed on an aarch64 platform which behaves correctly but
differently as described above.

Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5311
Closes #5313

Details

Provenance
Brian Behlendorf <behlendorf1@llnl.gov>Authored on Oct 21 2016, 3:23 PM
GitHub <noreply@github.com>Committed on Oct 21 2016, 3:23 PM
Parents
rG9523b15ac188: Fix coverity defects: CID 153459
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rGe4ffa98dcaf2: Fix userquota_compare() function (authored by Brian Behlendorf <behlendorf1@llnl.gov>).Oct 21 2016, 3:23 PM