It's okay but if your beer fills the carboy up too much there won't be room for the krausen to form. In this case you can rig up a blow off tube but with the beer very close to the carboy mouth and depending on the yeast strain and how vigorous the fermentation is, you may loose some beer or a lot of yeast to the blowoff.
Most people use a 6 gallon carboy for 5 gallon batches.