Schedule K-1 (Form 1120-S) - Figuring Adjusted Basis of Shareholder Interest
1
Per the IRS Shareholder's Instructions for Schedule K-1 (Form 1120S), page 2:

Basis Rules

Generally, the deduction for your share of aggregate losses and deductions reported on Schedule K-1 is limited to the basis of your stock (determined with regard to distributions received during the tax year) and loans from you to the corporation. For details and exceptions, see section 1366(d). The basis of your stock is generally figured at the end of the corporation's tax year. Any losses and deductions not allowed this year because of the basis limit can be carried forward indefinitely and deducted in a later year subject to the basis limit for that year.

You are responsible for keeping the information needed to figure the basis of your stock in the corporation. Schedule K-1 provides information to help you figure your stock basis at the end of each corporate tax year. The basis of your stock (generally, its cost) is adjusted as follows and, except as noted, in the order listed. In addition, basis may be adjusted under other provisions of the Internal Revenue Code. You can generally use the Worksheet for Figuring a Shareholder's Stock Basis (on page 2 of these instructions) to figure your aggregate stock basis.