and what is the output of
rpm -qf /lib/modules/2.6.32-431.20.3.el6.x86_64/weak-updates/mlnx-ofa_kernel/drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko
If should return the RPM name
And could you check if script will work if you change this line (163)
KER_RPM=`rpm -qf $mlx4_core_ko 2> /dev/null | grep -E "kernel-ib|ofa_kernel"`
to this
KER_RPM=`rpm -qf $mlx4_core_ko 2> /dev/null | grep -E "kernel-ib\|ofa_kernel"`