rm redundant code

Signed-off-by: Wei Jin <wjin.cn@gmail.com>
fix potential overflow

Signed-off-by: Wei Jin <wjin.cn@gmail.com>