Date: Sat, 16 Nov 2002 00:37:13 -0800 (PST) From: Julian Elischer <julian@elischer.org> To: Nate Lawson <nate@root.org> Cc: Tim Robbins <tjr@FreeBSD.ORG>, FreeBSD current users <current@FreeBSD.ORG> Subject: Re: Sign fixes for disklabel(8) Message-ID: <Pine.BSF.4.21.0211160011590.50399-200000@InterJet.elischer.org> In-Reply-To: <Pine.BSF.4.21.0211152205130.48493-100000@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-661448415-1037435833=:50399 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 15 Nov 2002, Nate Lawson wrote: > On Sat, 16 Nov 2002, Tim Robbins wrote: > > On Fri, Nov 15, 2002 at 03:59:25PM -0800, Julian Elischer wrote: > > > > > Here are the diffs to allow disklabel to correctly create partitions > > > > 1TB (up to 2TB is useful with UFS2) pending a different partitionning > > > scheme. It also allows you to correctly make smaller partitions beyond > > > 1TB which is nice if you don't want to waste 800GB on an array :-) > > > > > > > > > permission to commit please? > > > (pending comments by others) > > > > > > (also the sysinstall changes posted before) > > > (also the bluetooth code) > > [...] > > > - v = atoi(tp); > > > + v = strtoul(tp, NULL, 0); > > > if (v <= 0 || (v % DEV_BSIZE) != 0) { > > > fprintf(stderr, > > > "line %d: %s: bad sector size\n", > > > > Should be == 0, not <= 0 since v is unsigned. good catch. I've altered all the checks of v to be unsigned.. > > > > [...] > > > - v = atoi(tp); > > > + v = strtoul(tp, NULL, 0); > > > if (v < 0) { > > > fprintf(stderr, "line %d: %s: bad %s\n", > > > lineno, tp, cp); > > > > v < 0 is impossible. > > In the overflow case, strtoul returns ULONG_MAX. Or if you're interested > in catching invalid characters, use endptr. I'm not that interested in catching those cases.. they were not caught before and I'm looking for the minimal diff.. I've just removed the clause. See new patch attached.. A sensible thing might be to compare against a "sensible" value but who knows what that value should be? I include the new diff for your coments Any comments from anyone about the sysinstall fixes would also be apreciated.. > > -Nate > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > --0-661448415-1037435833=:50399 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="disklabel.current.diff" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.BSF.4.21.0211160037130.50399@InterJet.elischer.org> Content-Description: Content-Disposition: attachment; filename="disklabel.current.diff" SW5kZXg6IGRpc2tsYWJlbC5jDQo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQpS Q1MgZmlsZTogL2hvbWUvbmN2cy9zcmMvc2Jpbi9kaXNrbGFiZWwvZGlza2xh YmVsLmMsdg0KcmV0cmlldmluZyByZXZpc2lvbiAxLjYyDQpkaWZmIC11IC1y MS42MiBkaXNrbGFiZWwuYw0KLS0tIGRpc2tsYWJlbC5jCTggT2N0IDIwMDIg MTI6MTM6MTkgLTAwMDAJMS42Mg0KKysrIGRpc2tsYWJlbC5jCTE2IE5vdiAy MDAyIDA4OjIzOjE0IC0wMDAwDQpAQCAtOTQzLDcgKzk0Myw4IEBADQogCWNv bnN0IGNoYXIgKipjcHA7DQogCXVuc2lnbmVkIGludCBwYXJ0Ow0KIAljaGFy ICp0cCwgbGluZVtCVUZTSVpdOw0KLQlpbnQgdiwgbGluZW5vID0gMCwgZXJy b3JzID0gMDsNCisJdW5zaWduZWQgaW50IHY7DQorCWludCBsaW5lbm8gPSAw LCBlcnJvcnMgPSAwOw0KIAlpbnQgaTsNCiANCiAJbHAtPmRfYmJzaXplID0g QkJTSVpFOwkJCQkvKiBYWFggKi8NCkBAIC05NzMsNyArOTc0LDcgQEANCiAJ CQkJfQ0KIAkJCWlmIChjcHAgPCAmZGt0eXBlbmFtZXNbREtNQVhUWVBFU10p DQogCQkJCWNvbnRpbnVlOw0KLQkJCXYgPSBhdG9pKHRwKTsNCisJCQl2ID0g c3RydG91bCh0cCwgTlVMTCwgM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NCiAJCWZwcmludGYoc3RkZXJyLCAi bGluZSAlZDogJXM6IGJhZCBwYXJ0aXRpb24gb2Zmc2V0XG4iLCBsaW5lbm8s DQogCQkgICAgY3ApOw0KIAkJcmV0dXJuICgxKTsNCkBAIC0xMjQwLDcgKzEy MjEsNyBAQA0KIAkJcHAtPnBfZnN0eXBlID0gY3BwIC0gZnN0eXBlbmFtZXM7 DQogCX0gZWxzZSB7DQogCQlpZiAoaXNkaWdpdCgqY3ApKQ0KLQkJCXYgPSBh dG9pKGNwKTsNCisJCQl2ID0gc3RydG91bChjcCwgTlVMTCwgMCk7DQogCQll bHNlDQogCQkJdiA9IEZTTUFYVFlQRVM7DQogCQlpZiAoKHVuc2lnbmVkKXYg Pj0gRlNNQVhUWVBFUykgew0K --0-661448415-1037435833=:50399-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0211160011590.50399-200000>