Generalizing the Martens theorem for line bundles over a curve C, we obtain upper bounds on the dimension of the Brill–Noether locus \(B^k_{n, d}\) parametrizing stable bundles of rank \(n \ge 2\) and degree d over C with at least k independent sections. This proves a conjecture of the second author and generalizes bounds obtained by him in the rank two case. We give more refined results for some values of d, including a generalized Mumford theorem for \(n \ge 2\) when \(d \le g - 1\) . The statements are obtained chiefly by analysis of the tangent spaces of \(B^k_{n, d}\) . As an application, we show that for \(n\ge 5\) the locus \(B^2_{n, n(g-1)}\) is irreducible and reduced for any C.