If you're talking about a pre 2007 model with a M54B30, which is an extremely good engine IMHO, has the following common problems with age (which can be dealt with quite easily)
Cooling System failures (expansion tank/radiator/hoses/thermostat housing/water pump)
VANOS seals failing
Crank Case Ventilation (CCV) valve failing
Oil leaks (Oil Filter Housing Gasket, Valve cover gasket, Oil pan gasket, Rear Main Seal)
DISA valve failing
Do a search for them online. A lot of info!! With some preemptive maintenance,the engine at least is pretty reliable.