Skip to content

Commit fb33118

Browse files
geertudavem330
authored andcommitted
net: sctp: Move sequence start handling into sctp_transport_get_idx()
net/sctp/proc.c: In function ‘sctp_transport_get_idx’: net/sctp/proc.c:313: warning: ‘obj’ may be used uninitialized in this function This is currently a false positive, as all callers check for a zero offset first, and handle this case in the exact same way. Move the check and handling into sctp_transport_get_idx() to kill the compiler warning, and avoid future bugs. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 34ae6a1 commit fb33118

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎net/sctp/proc.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static struct sctp_transport *sctp_transport_get_next(struct seq_file *seq)
310310
static struct sctp_transport *sctp_transport_get_idx(struct seq_file *seq,
311311
loff_t pos)
312312
{
313-
void *obj;
313+
void *obj = SEQ_START_TOKEN;
314314

315315
while (pos && (obj = sctp_transport_get_next(seq)) && !IS_ERR(obj))
316316
pos--;
@@ -347,7 +347,7 @@ static void *sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos)
347347
if (err)
348348
return ERR_PTR(err);
349349

350-
return *pos ? sctp_transport_get_idx(seq, *pos) : SEQ_START_TOKEN;
350+
return sctp_transport_get_idx(seq, *pos);
351351
}
352352

353353
static void sctp_assocs_seq_stop(struct seq_file *seq, void *v)
@@ -462,7 +462,7 @@ static void *sctp_remaddr_seq_start(struct seq_file *seq, loff_t *pos)
462462
if (err)
463463
return ERR_PTR(err);
464464

465-
return *pos ? sctp_transport_get_idx(seq, *pos) : SEQ_START_TOKEN;
465+
return sctp_transport_get_idx(seq, *pos);
466466
}
467467

468468
static void *sctp_remaddr_seq_next(struct seq_file *seq, void *v, loff_t *pos)

0 commit comments

Comments
 (0)