A Carlitz type result for linearized polynomials