Re: [PATCH 04/19] mkfs: validate all input values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/24/16 6:15 AM, jtulak@xxxxxxxxxx wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> CHANGELOG
> o Fix an unsigned < 0 comparison - save getnum result to another variable
>   and test it, before converting it to unsigned logagno.

...

> @@ -1468,7 +1485,10 @@ main(
>  						respec('l', lopts, L_AGNUM);
>  					if (ldflag)
>  						conflict('l', lopts, L_AGNUM, L_DEV);
> -					logagno = atoi(value);
> +					tmp_num = getnum(value, 0, 0, false);
> +					if (tmp_num < 0)
> +						illegal(value, "l agno");
> +					logagno = (xfs_agnumber_t)tmp_num;
>  					laflag = 1;
>  					break;
>  				case L_FILE:

Why not cast to (__int64_t) like other variables do?  i.e.


+					logagno = getnum(value, 0, 0, false);
+					if ((__int64_t)logagno < 0)
+						illegal(value, "l agno");

or am I missing something?

Thanks,
-Eric

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux