How do you respond when he does it? Do you run over and scoop him up? Do you shout? Is your worry obvious? If he isn't actually hurting himself you could probably ignore it. Or get a playpen and every time he does it lift him without comment and set him in so he's safe and then ignore him for a minute or two.