Re: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
On 05/22/2017 12:40 PM, SF Markus Elfring wrote: > From: Markus Elfring> Date: Mon, 22 May 2017 18:08:24 +0200 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > Signed-off-by: Markus Elfring > --- > net/sctp/protocol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c > index 64756c42cec9..057479b7bd72 100644 > --- a/net/sctp/protocol.c > +++ b/net/sctp/protocol.c > @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block > *this, unsigned long ev, > > switch (ev) { > case NETDEV_UP: > - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); > + addr = kmalloc(sizeof(*addr), GFP_ATOMIC); > if (addr) { > addr->a.v4.sin_family = AF_INET; > addr->a.v4.sin_port = 0; > Acked-by: Vlad Yasevich -vlad
Re: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
On 05/22/2017 12:40 PM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Mon, 22 May 2017 18:08:24 +0200 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > Signed-off-by: Markus Elfring > --- > net/sctp/protocol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c > index 64756c42cec9..057479b7bd72 100644 > --- a/net/sctp/protocol.c > +++ b/net/sctp/protocol.c > @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block > *this, unsigned long ev, > > switch (ev) { > case NETDEV_UP: > - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); > + addr = kmalloc(sizeof(*addr), GFP_ATOMIC); > if (addr) { > addr->a.v4.sin_family = AF_INET; > addr->a.v4.sin_port = 0; > Acked-by: Vlad Yasevich -vlad
Re: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
On Mon, May 22, 2017 at 06:40:37PM +0200, SF Markus Elfring wrote: > From: Markus Elfring> Date: Mon, 22 May 2017 18:08:24 +0200 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > Signed-off-by: Markus Elfring Acked-by: Marcelo Ricardo Leitner > --- > net/sctp/protocol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c > index 64756c42cec9..057479b7bd72 100644 > --- a/net/sctp/protocol.c > +++ b/net/sctp/protocol.c > @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block > *this, unsigned long ev, > > switch (ev) { > case NETDEV_UP: > - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); > + addr = kmalloc(sizeof(*addr), GFP_ATOMIC); > if (addr) { > addr->a.v4.sin_family = AF_INET; > addr->a.v4.sin_port = 0; > -- > 2.13.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sctp" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >
Re: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
On Mon, May 22, 2017 at 06:40:37PM +0200, SF Markus Elfring wrote: > From: Markus Elfring > Date: Mon, 22 May 2017 18:08:24 +0200 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > Signed-off-by: Markus Elfring Acked-by: Marcelo Ricardo Leitner > --- > net/sctp/protocol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c > index 64756c42cec9..057479b7bd72 100644 > --- a/net/sctp/protocol.c > +++ b/net/sctp/protocol.c > @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block > *this, unsigned long ev, > > switch (ev) { > case NETDEV_UP: > - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); > + addr = kmalloc(sizeof(*addr), GFP_ATOMIC); > if (addr) { > addr->a.v4.sin_family = AF_INET; > addr->a.v4.sin_port = 0; > -- > 2.13.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sctp" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >
[PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
From: Markus ElfringDate: Mon, 22 May 2017 18:08:24 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- net/sctp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 64756c42cec9..057479b7bd72 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, switch (ev) { case NETDEV_UP: - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); + addr = kmalloc(sizeof(*addr), GFP_ATOMIC); if (addr) { addr->a.v4.sin_family = AF_INET; addr->a.v4.sin_port = 0; -- 2.13.0
[PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
From: Markus Elfring Date: Mon, 22 May 2017 18:08:24 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- net/sctp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 64756c42cec9..057479b7bd72 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, switch (ev) { case NETDEV_UP: - addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC); + addr = kmalloc(sizeof(*addr), GFP_ATOMIC); if (addr) { addr->a.v4.sin_family = AF_INET; addr->a.v4.sin_port = 0; -- 2.13.0