The instructions for your saw should indicate the bar sizes that you can use. It is not recommended to install a chainsaw bar longer than indicated by the manufacturer, because this affects the engine speed.  The longer the chainsaw bar, the more the engine spends power to rotate the crankshaft to accelerate the chain, and this affects engine wear. This is the most important rule to follow.