Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 2013 15:03:27 +0200
From:      Mario Oshogbo <oshogbo@FreeBSD.org>
To:        freebsd-net@freebsd.org
Cc:        mjguzik@gmail.com, andre@FreeBSD.org
Subject:   soreceive_generic and soreceive_dgram error checking
Message-ID:  <CAGOYWV9JZW4LJ1BnTPcrZAAq3NdnqQiPgNyydFz%2BExA2nMM4cA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--20cf301af5c57ddfc904e18c7ccb
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I'm a student working in GSoC project. My task on this summer is to
write some new features for capsicum framework. Currently I working on
writing two new rights (CAP_SEND_RIGHTS and CAP_RECV_RIGHTS). I have
some questions about error checking in the soreceive_generic and the
soreceive_dgram.

I noticed that after calling dom_externalize function there was no
explicit error checks. After code analysis of soreceive_generic is
likely that error will be returned property. But still, are we need
some more things to do after calling dom_externalize or we could
simply jump to the release if we got some error from that function?

The more puzzling situation is with sorecive_dgram. After calling
dom_externalize we don't check the error anywhere. We also don't
return the error on the end of the function. Even if we change "return
0" to the "return error" there is still the chance that error will be
override by other function (like uimove). Its there any
contraindications to add after calling dom_externalize simply check
returned value and handle error?

I also attach diff with my proposal of error checking in both functions.
Should we apply it for both function or we should only change
soreceive_dgram or ma by none?
Should we make some other changes in soreceive_dgram?

I will be very grateful for any help,
oshogbo

--20cf301af5c57ddfc904e18c7ccb
Content-Type: application/octet-stream; name="uipc_socket.diff"
Content-Disposition: attachment; filename="uipc_socket.diff"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hj5og57s0

LS0tIHVpcGNfc29ja2V0LmMJMjAxMy0wNi0yOCAxMToxNDoyMi4wMDAwMDAwMDAgKzAyMDAKKysr
IHVpcGNfc29ja2V0LmMJMjAxMy0wNy0xNSAxNDo1MzoxNS4wMDAwMDAwMDAgKzAyMDAKQEAgLTE3
MjgsNiArMTcyOCw4IEBAIGRvbnRibG9jazoKIAkJCQlWTkVUX1NPX0FTU0VSVChzbyk7CiAJCQkJ
ZXJyb3IgPSAoKnByLT5wcl9kb21haW4tPmRvbV9leHRlcm5hbGl6ZSkKIAkJCQkgICAgKGNtLCBj
b250cm9scCwgZmxhZ3MpOworCQkJCWlmIChlcnJvciAhPSAwKQorCQkJCQlnb3RvIHJlbGVhc2U7
CiAJCQkJU09DS0JVRl9MT0NLKCZzby0+c29fcmN2KTsKIAkJCX0gZWxzZSBpZiAoY29udHJvbHAg
IT0gTlVMTCkKIAkJCQkqY29udHJvbHAgPSBjbTsKQEAgLTIzNjMsNiArMjM2NSwxMCBAQCBzb3Jl
Y2VpdmVfZGdyYW0oc3RydWN0IHNvY2tldCAqc28sIHN0cnVjCiAJCQlpZiAocHItPnByX2RvbWFp
bi0+ZG9tX2V4dGVybmFsaXplICE9IE5VTEwpIHsKIAkJCQllcnJvciA9ICgqcHItPnByX2RvbWFp
bi0+ZG9tX2V4dGVybmFsaXplKQogCQkJCSAgICAoY20sIGNvbnRyb2xwLCBmbGFncyk7CisJCQkJ
aWYgKGVycm9yICE9IDApIHsKKwkJCQkJbV9mcmVlbShtKTsKKwkJCQkJcmV0dXJuIChlcnJvcik7
CisJCQkJfQogCQkJfSBlbHNlIGlmIChjb250cm9scCAhPSBOVUxMKQogCQkJCSpjb250cm9scCA9
IGNtOwogCQkJZWxzZQo=
--20cf301af5c57ddfc904e18c7ccb--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGOYWV9JZW4LJ1BnTPcrZAAq3NdnqQiPgNyydFz%2BExA2nMM4cA>