* [TRIVIAL PATCH 2.5.48] Fixed ifdefs for a label in ncpfs/sock.c
@ 2002-11-19 18:52 Bob Miller
2002-11-19 19:02 ` Dave Jones
0 siblings, 1 reply; 5+ messages in thread
From: Bob Miller @ 2002-11-19 18:52 UTC (permalink / raw)
To: trivial; +Cc: linux-kernel
diff -Nru a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c
--- a/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002
+++ b/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002
@@ -587,7 +587,9 @@
}
#endif
type = ntohs(server->rcv.buf.type);
+#ifdef CONFIG_NCPFS_PACKET_SIGNING
cont:;
+#endif
if (type != NCP_REPLY) {
if (datalen - 8 <= sizeof(server->unexpected_packet.data)) {
*(__u16*)(server->unexpected_packet.data) = htons(type);
--
Bob Miller Email: rem@osdl.org
Open Source Development Lab Phone: 503.626.2455 Ext. 17
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [TRIVIAL PATCH 2.5.48] Fixed ifdefs for a label in ncpfs/sock.c 2002-11-19 18:52 [TRIVIAL PATCH 2.5.48] Fixed ifdefs for a label in ncpfs/sock.c Bob Miller @ 2002-11-19 19:02 ` Dave Jones 2002-11-19 20:58 ` Bob Miller 2002-11-19 23:13 ` Robert Love 0 siblings, 2 replies; 5+ messages in thread From: Dave Jones @ 2002-11-19 19:02 UTC (permalink / raw) To: Bob Miller; +Cc: trivial, linux-kernel On Tue, Nov 19, 2002 at 10:52:36AM -0800, Bob Miller wrote: > diff -Nru a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c > --- a/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002 > +++ b/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002 > @@ -587,7 +587,9 @@ > } > #endif > type = ntohs(server->rcv.buf.type); > +#ifdef CONFIG_NCPFS_PACKET_SIGNING > cont:; > +#endif > if (type != NCP_REPLY) { > if (datalen - 8 <= sizeof(server->unexpected_packet.data)) { Eww, personally I think the fix is worse than the warning. Dave -- | Dave Jones. http://www.codemonkey.org.uk | SuSE Labs ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [TRIVIAL PATCH 2.5.48] Fixed ifdefs for a label in ncpfs/sock.c 2002-11-19 19:02 ` Dave Jones @ 2002-11-19 20:58 ` Bob Miller 2002-11-19 21:50 ` Petr Vandrovec 2002-11-19 23:13 ` Robert Love 1 sibling, 1 reply; 5+ messages in thread From: Bob Miller @ 2002-11-19 20:58 UTC (permalink / raw) To: Dave Jones, trivial, linux-kernel On Tue, Nov 19, 2002 at 07:02:17PM +0000, Dave Jones wrote: > On Tue, Nov 19, 2002 at 10:52:36AM -0800, Bob Miller wrote: > > diff -Nru a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c > > --- a/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002 > > +++ b/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002 > > @@ -587,7 +587,9 @@ > > } > > #endif > > type = ntohs(server->rcv.buf.type); > > +#ifdef CONFIG_NCPFS_PACKET_SIGNING > > cont:; > > +#endif > > if (type != NCP_REPLY) { > > if (datalen - 8 <= sizeof(server->unexpected_packet.data)) { > > Eww, personally I think the fix is worse than the warning. > > Dave I know. I personally hate #ifdef's and goto's... I spent more than a few minutes trying to find a "trivial" way to clean this up, but this was the best I could do without reorganizing LOTS of code (then it's not "trivial" anymore). -- Bob Miller Email: rem@osdl.org Open Source Development Lab Phone: 503.626.2455 Ext. 17 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [TRIVIAL PATCH 2.5.48] Fixed ifdefs for a label in ncpfs/sock.c 2002-11-19 20:58 ` Bob Miller @ 2002-11-19 21:50 ` Petr Vandrovec 0 siblings, 0 replies; 5+ messages in thread From: Petr Vandrovec @ 2002-11-19 21:50 UTC (permalink / raw) To: Bob Miller; +Cc: Dave Jones, trivial, linux-kernel On Tue, Nov 19, 2002 at 12:58:23PM -0800, Bob Miller wrote: > On Tue, Nov 19, 2002 at 07:02:17PM +0000, Dave Jones wrote: > > On Tue, Nov 19, 2002 at 10:52:36AM -0800, Bob Miller wrote: > > > diff -Nru a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c > > > --- a/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002 > > > +++ b/fs/ncpfs/sock.c Tue Nov 19 10:31:17 2002 > > > @@ -587,7 +587,9 @@ > > > } > > > #endif > > > type = ntohs(server->rcv.buf.type); > > > +#ifdef CONFIG_NCPFS_PACKET_SIGNING > > > cont:; > > > +#endif > > > if (type != NCP_REPLY) { > > > if (datalen - 8 <= sizeof(server->unexpected_packet.data)) { > > > > Eww, personally I think the fix is worse than the warning. > > > > Dave > I know. I personally hate #ifdef's and goto's... I spent more than a few > minutes trying to find a "trivial" way to clean this up, but this was > the best I could do without reorganizing LOTS of code (then it's not > "trivial" anymore). If you want just eliminate some gotos (and eventually warnings... you should always enable packet signing, btw), try this one ;-) But I'm not sure that code below is better than using goto... Petr Vandrovec (ncpfs maintainer) diff -u linux-2.5.48-c903.dist/fs/ncpfs/sock.c linux-2.5.48-c903/fs/ncpfs/sock.c --- linux-2.5.48-c903.dist/fs/ncpfs/sock.c 2002-11-19 15:28:26.000000000 +0100 +++ linux-2.5.48-c903/fs/ncpfs/sock.c 2002-11-19 22:46:39.000000000 +0100 @@ -584,10 +584,12 @@ server->rcv.len = 8; server->rcv.state = 4; break; - } + case 4: + datalen = server->rcv.buf.len; + type = ntohs(server->rcv.buf.type2); + } else #endif type = ntohs(server->rcv.buf.type); -cont:; if (type != NCP_REPLY) { if (datalen - 8 <= sizeof(server->unexpected_packet.data)) { *(__u16*)(server->unexpected_packet.data) = htons(type); @@ -622,12 +624,6 @@ server->rcv.len = datalen - 10; server->rcv.state = 1; break; -#ifdef CONFIG_NCPFS_PACKET_SIGNING - case 4: - datalen = server->rcv.buf.len; - type = ntohs(server->rcv.buf.type2); - goto cont; -#endif case 1: req = server->rcv.creq; if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) { @@ -652,20 +648,20 @@ } #endif ncp_finish_request(req, req->datalen); - nextreq:; + if (0) { + case 3: + ncp_finish_request(server->rcv.creq, -EIO); + } __ncp_next_request(server); + if (0) { + case 5: + info_server(server, 0, server->unexpected_packet.data, server->unexpected_packet.len); + } case 2: - next:; server->rcv.ptr = (unsigned char*)&server->rcv.buf; server->rcv.len = 10; server->rcv.state = 0; break; - case 3: - ncp_finish_request(server->rcv.creq, -EIO); - goto nextreq; - case 5: - info_server(server, 0, server->unexpected_packet.data, server->unexpected_packet.len); - goto next; } } } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [TRIVIAL PATCH 2.5.48] Fixed ifdefs for a label in ncpfs/sock.c 2002-11-19 19:02 ` Dave Jones 2002-11-19 20:58 ` Bob Miller @ 2002-11-19 23:13 ` Robert Love 1 sibling, 0 replies; 5+ messages in thread From: Robert Love @ 2002-11-19 23:13 UTC (permalink / raw) To: Dave Jones; +Cc: Bob Miller, trivial, linux-kernel On Tue, 2002-11-19 at 14:02, Dave Jones wrote: > Eww, personally I think the fix is worse than the warning. Yah that is ugly, but I personally think we should strive to eliminate warnings. One day this really may be an unused label. I am not sure how else to cleanly get rid of this. Robert Love ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-11-19 23:06 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-11-19 18:52 [TRIVIAL PATCH 2.5.48] Fixed ifdefs for a label in ncpfs/sock.c Bob Miller 2002-11-19 19:02 ` Dave Jones 2002-11-19 20:58 ` Bob Miller 2002-11-19 21:50 ` Petr Vandrovec 2002-11-19 23:13 ` Robert Love
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox